1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-17 12:41:05 +03:00
Commit Graph

268 Commits

Author SHA1 Message Date
Eric Blake
61c96af09d getopt-gnu: match recent glibc fixes and posix ruling
The POSIX folks admitted that codifying the behavior of GNU
getopt on a leading '+' in optstring is worthwhile, for writing
programs such as env(1) even when POSIXLY_CORRECT is not defined.
http://austingroupbugs.net/view.php?id=191
However, the ruling is an enhancement request for the next
version of POSIX, and is not binding on platforms that comply
with POSIX 2008, so it should only be enforced for getopt-gnu.

* tests/test-getopt.h (test_getopt): Strengthen tests of leading
'+' handling, when requesting extensions.
* tests/test-getopt_long.h (test_getopt_long): Strengthen test of
'W;' handling.
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Detect glibc 2.11 bug.
* doc/posix-functions/getopt.texi (getopt): Document this.
* doc/glibc-functions/getopt_long.texi (getopt_long): Likewise.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.
2010-04-13 16:31:48 -06:00
Eric Blake
5cc0bcf5e4 getopt-posix: detect MacOS bug
On MacOS 10.5 (Darwin 9.8.0), optind is incremented by 2 instead
of 1 in the case of a missing requirement on condensed options.

* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Reject MacOS botch of
optind when missing a required argument.
* doc/posix-functions/getopt.texi (getopt): Document the bug.
* doc/glibc-functions/getopt_long.texi (getopt_long): Likewise.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-13 16:31:47 -06:00
Jim Meyering
950f3469e4 ftruncate: mark module as obsolete; even MinGW provides it, now
* modules/ftruncate (Status): Obsolete.
(Notice): Say that.
* doc/posix-functions/ftruncate.texi: Don't say MinGW lacks it.
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/9203
2010-04-09 10:44:23 +02:00
Bruno Haible
bfbf5dbc5e btowc: Work around Cygwin 1.7.2 bug. 2010-04-06 00:30:42 +02:00
Bruno Haible
097fd2f5f5 New module 'strncat'. 2010-04-05 21:15:36 +02:00
Bruno Haible
edca4071fc Assume rmdir exists. 2010-04-05 17:27:57 +02:00
Bruno Haible
6fd3d63e39 strerror: Update documentation. 2010-04-04 23:07:50 +02:00
Bruno Haible
f25b18d1c0 frexpl: Fix a C++ test error on Solaris 8 and Cygwin. 2010-04-04 22:13:20 +02:00
Bruno Haible
1349ff1c34 time_r: Minor updates. 2010-04-03 18:47:03 +02:00
Eric Blake
497bb5fc57 fdopendir: work around FreeBSD bug
Without a declaration, at least tar would core dump on 64-bit
FreeBSD because gcc only used 32 bits of the resulting pointer.

* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): New witness.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Set it.
* modules/dirent (Makefile.am): Substitute it.
* lib/dirent.in.h (fdopendir): Supply missing FreeBSD
declaration.
* doc/posix-functions/fdopendir.texi (fdopendir): Document the
fix.
Reported by Christian Weisgerber <naddy@mips.inka.de>.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-03-30 08:26:01 -06:00
Bruno Haible
2169eadded Fix ioctl's protoype on glibc systems. 2010-03-29 02:27:39 +02:00
Bruno Haible
d26ede5aec setenv: Tweaks. 2010-03-21 23:24:17 +01:00
Bruno Haible
e6c527d59a New module 'unlockpt'. 2010-03-21 23:19:30 +01:00
Bruno Haible
aeca137662 New module 'grantpt'. 2010-03-21 20:16:38 +01:00
Bruno Haible
3b7b97813f New module 'ptsname'. 2010-03-21 16:17:22 +01:00
Bruno Haible
116440ae18 New module 'ttyname_r'. 2010-03-21 14:38:25 +01:00
Bruno Haible
12107b837d Work around unlink() bug on MacOS X 10.5.6. 2010-03-20 15:26:42 +01:00
Bruno Haible
cbe58fc8e5 wctype: Provide iswblank function. 2010-03-19 22:46:56 +01:00
Eric Blake
67b8e6a482 logb: fix documentation
* doc/posix-functions/logb.texi (logb): Gnulib fixes the cygwin
1.5 declaration bug.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-03-19 09:44:43 -06:00
Bruno Haible
10d66aedfd logb: Provide missing declaration for Cygwin. 2010-03-08 00:04:47 +01:00
Bruno Haible
89e5b6ba03 Clarify access, euidaccess, faccessat. 2010-03-07 16:32:47 +01:00
Jim Meyering
95907a5453 utime: remove obsolete module
This module, like autoconf's AC_FUNC_UTIME_NULL macro, has been
unnecessary for years, and has been marked as obsolete for 10 months.
* modules/utime: Remove file.
* lib/utime.c: Remove file.
* m4/utime.m4: Remove file.
* m4/utimes-null.m4: Remove file.
* doc/posix-functions/utime.texi (utime): Remove reference to
the module.  Move the sole "fixed by gnulib" item into the
"problems not fixed by Gnulib" list.
* MODULES.html.sh (func_all_modules): Remove reference to "utime".
2010-03-05 08:52:39 +01:00
Simon Josefsson
fa93ceab81 exit: Obsolete module, use stdlib instead. 2010-03-05 07:51:36 +01:00
Eric Blake
de4d0a383b gettimeofday: expose type of second argument
Needed to silence compiler warnings such as:
test-gettimeofday.c:23: warning: initialization from incompatible pointer type
based on whether gettimeofday complies with POSIX or provides
the extension of struct timezone.

* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Do better detection
of glibc extension signature, and define GETTIMEOFDAY_TIMEZONE.
* tests/test-gettimeofday.c: Use it to silence warning.
* doc/posix-functions/gettimeofday.texi (gettimeofday): Document
the issue.

Signed-off-by: Eric Blake <ebb9@byu.net>
2010-02-04 20:01:45 -07:00
Bruno Haible
c51097b06a Work around getdelim() bug on FreeBSD 8.0. 2010-01-31 17:43:25 +01:00
Bruno Haible
1150c074e8 Work around getline() bug on FreeBSD 8.0. 2010-01-31 17:30:24 +01:00
Bruno Haible
73e329f111 New modules acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl. 2010-01-19 02:59:13 +01:00
Bruno Haible
8b893ddd37 New modules for common <math.h> functions. 2010-01-19 01:43:27 +01:00
Bruno Haible
907734847d New module 'getlogin'. 2010-01-09 16:17:50 +01:00
Bruno Haible
cc6a6870c5 doc: Clarify the platforms. 2010-01-07 21:33:02 +01:00
Eric Blake
f8b8f4f5e1 strcase: document what it provides
* doc/posix-functions/strcasecmp.texi (strcasecmp): Mention the
gnulib module.
* doc/posix-functions/strncasecmp.texi (strncasecmp): Likewise.
Reported by Dilyan Palauzov <Dilyan.Palauzov@aegee.org>.

Signed-off-by: Eric Blake <ebb9@byu.net>
2010-01-05 20:23:07 -07:00
Eric Blake
87f8903d4b doc: correct availability of cygwin 1.5.x getopt
* doc/posix-functions/optarg.texi (optarg): Cygwin supplies getopt
variables.
* doc/posix-functions/opterr.texi (opterr): Likewise.
* doc/posix-functions/optind.texi (optind): Likewise.
* doc/posix-functions/optopt.texi (optopt): Likewise.
* doc/posix-functions/tzname.texi (tzname): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-31 19:25:52 -07:00
Bruno Haible
a9c425fc8e iconv: Reject native Solaris iconv. 2010-01-01 01:57:29 +01:00
Eric Blake
86c22b430f unistd: work around cygwin bug
Cygwin 1.7.1 placed symlinkat and unlinkat in the wrong headers
(due to a bug in the Linux man pages).

* lib/unistd.in.h (includes): Pick up headers needed for cygwin.
* doc/posix-functions/unlinkat.texi (unlinkat): Document the bug.
* doc/posix-functions/symlinkat.texi (symlinkat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-23 21:12:40 -07:00
Eric Blake
4e86671af6 getsubopt: work around cygwin bug
On cygwin, compiling with -DGNULIB_POSIXCHECK failed because
the getsubopt link warning definition interfered with the
inclusion of the system header.  The fix, as always in these
types of problems, is to ensure that system headers are
completely included before doing any overrides.

* lib/stdlib.in.h (includes): Move unistd inclusion sooner, to
avoid conflicting with system getsubopt.
* doc/posix-functions/getsubopt.texi (getsubopt): Document the
bug.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-22 06:53:45 -07:00
Eric Blake
3c8bb39bef test-getopt: test stderr behavior
Portions of this commit are commented out because they tickle
glibc bugs.  For a real-life example of the bug:

$ env -ua -:
env: invalid option -- :
Try `env --help' for more information.
$ env -:
env: invalid option -- :
Try `env --help' for more information.
$ env -+
env: invalid option -- +
Try `env --help' for more information.
$ env -ua -+
Try `env --help' for more information.

Notice that when -+ is not given as the first argument, the
error message is mistakenly suppressed.

* modules/getopt-posix-tests (Depends-on): Add dup2.
* tests/test-getopt.c (ASSERT): Avoid stderr.
(main): Move stderr to a temporary file.
* tests/test-getopt.h (getopt_loop): No longer manipulate opterr.
Instead, add parameter to inform caller if output occurred.
(test_getopt): Adjust all tests to expect silence, and add new
tests of leading ":".
* doc/glibc-functions/getopt_long.texi (getopt_long): Document
glibc shortcomings with leading "-:" or "+:" in optstring.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.
* doc/posix-functions/getopt.texi (getopt): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-22 06:44:00 -07:00
Eric Blake
9963a98120 utimens: check for ctime update
futimens/utimensat on Linux fails to bump ctime if mtime is
UTIME_OMIT and atime is specified.

* tests/test-utimens-common.h (check_ctime): Define.
* tests/test-utimens.h (test_utimens): Expose the Linux bug.
* tests/test-futimens.h (test_futimens): Likewise.
* tests/test-lutimens.h (test_lutimens): Likewise.
* doc/posix-functions/futimens.texi (futimens): Document the bug.
* doc/posix-functions/utimensat.texi (utimensat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-19 16:56:38 -07:00
Eric Blake
021c861919 fcntl: port portions of fcntl to mingw
Borrow ideas from dup_cloexec and dup3 to implement F_DUPFD and
F_DUPFD_CLOEXEC.  Support querying the inheritance status via
F_GETFD, but for now, no support for changing with F_SETFD.
The remaining portions of fcntl fail with EINVAL.

* m4/fcntl.m4 (gl_FUNC_FCNTL): Also build fcntl.c on mingw.
* lib/fcntl.c (fcntl) <F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD>: Provide
replacement for mingw.
* modules/fcntl (Description): Update.
(Depends-on): Add dup2.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness.
* modules/fcntl-h (Makefile.am): Substitute it.
* lib/fcntl.in.h (fcntl): Update declaration.
(F_DUPFD, F_GETFD): New macros, when needed.
* doc/posix-headers/fcntl.texi (fcntl.h): Update documentation.
* doc/posix-functions/fcntl.texi (fcntl): Likewise.
* tests/test-fcntl.c (check_flags, main): Enhance test for items
we now guarantee.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-16 19:25:34 -07:00
Eric Blake
da91bb7df9 fcntl: work around cygwin bug in F_DUPFD
fcntl(0,F_DUPFD,10000000) mistakenly failed with EMFILE
instead of EINVAL, and fcntl(0,F_DUPFD,-1) mistakenly passed.

* m4/fcntl.m4 (gl_REPLACE_FCNTL): New macro.
(gl_FUNC_FCNTL): Use it.  Test for F_DUPFD bug.
* lib/fcntl.c (rpl_fcntl) <F_DUPFD>: Work around it.
<F_DUPFD_CLOEXEC>: Reduce calls to _gl_register_dup.
* doc/posix-functions/fcntl.texi (fcntl): Document it.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-16 19:25:32 -07:00
Eric Blake
38f87b03c2 fcntl: support F_DUPFD_CLOEXEC on systems with fcntl
Implement F_DUPFD_CLOEXEC.  The unit test still fails on systems
with other fcntl bugs (such as cygwin 1.5 mishandling F_DUPFD,
or mingw lacking fcntl altogether).  Passes on Linux, both with
and without kernel support, and on cygwin 1.7.

* modules/fcntl (Files): List new files.
(configure.ac): Run a test.
* m4/fcntl.m4 (gl_FUNC_FCNTL): New file.
* lib/fcntl.c (rpl_fcntl): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness defaults.
(gl_FCNTL_H): Always replace fcntl.h.
* modules/fcntl-h (Makefile.am): Substitute witnesses.
* lib/fcntl.in.h (fcntl): Declare replacement.
(F_DUPFD_CLOEXEC, GNULIB_defined_F_DUPFD_CLOEXEC): New macro when
needed, plus a witness.
* doc/posix-functions/fcntl.texi (fcntl): Document this.
* doc/posix-headers/fcntl.texi (fcntl.h): Likewise.
* tests/test-fcntl.c: New file.
* modules/fcntl-tests: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-16 19:25:30 -07:00
Eric Blake
91e21656de setenv: relax requirement in light of POSIX ruling
Requiring that {un,}setenv gracefully reject NULL is just a waste
of processing power; POSIX agreed to this argument in
 http://austingroupbugs.net/view.php?id=185
so we no longer worry whether a native implementation handles NULL.

* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test handling of "" but
not NULL.
* tests/test-setenv.c (main): Relax test.
* tests/test-unsetenv.c (main): Likewise.
* doc/posix-functions/setenv.texi (setenv): Document this.
* doc/posix-functions/unsetenv.texi (unsetenv): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-12-11 13:57:28 -07:00
Bruno Haible
fdf6b0ba13 New module 'nl_langinfo'. 2009-12-11 20:09:02 +01:00
Bruno Haible
bd5a4d9f11 unsetenv: Document last workaround. 2009-12-09 22:04:36 +01:00
Eric Blake
c0c5acfbe2 getopt-gnu: flush out another BSD bug
POSIX requires 'echo foo > bar; m4 -Dfoo=1 bar -Dfoo=2 bar' to
output '1' then '2'.  To achieve this, m4 relies on the GNU
getopt{,_long} extension of a leading '-'.  However, BSD getopt
fails to honor this extension when POSIXLY_CORRECT.

Also, BSD getopt fails to reparse POSIXLY_CORRECT from the
environment even when a reset is requested (whether by
optreset=1 or by optind=0).

* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Test for the bug.
* tests/test-getopt.c (main): Check POSIXLY_CORRECT first, to
flush out BSD bug.
* tests/test-getopt.h (test_getopt): End lists with NULL.
* tests/test-getopt_long.h (test_getopt_long): Likewise.
(test_getopt_long_posix): Enhance test.
* modules/getopt-posix-tests (Depends-on): Add stdbool.
* doc/glibc-functions/getopt_long.texi (getopt_long): Mention
getopt-gnu.
* doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-11-27 20:29:00 -07:00
Jim Meyering
f84e1a91fb pread: new module
* modules/pread: New file.
* lib/pread.c (pread): New file.
* m4/pread.m4: Likewise.
* lib/unistd.in.h (pread): Define/declare.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Define defaults.
* modules/unistd (Makefile.am): Substitute witnesses.
* doc/posix-functions/pread.texi (pread): Update.
* MODULES.html.sh: Add pread.
2009-11-25 14:56:06 +01:00
Bruno Haible
44834c9e89 doc: Most *_l functions exist in MacOS X 10.5. 2009-11-25 01:53:37 +01:00
Bruno Haible
def5620070 doc: Most *_l functions exist in MacOS X 10.5. 2009-11-25 01:49:04 +01:00
Bruno Haible
3f0d472e05 New module 'duplocale'. 2009-11-23 01:48:36 +01:00
Eric Blake
a905b35027 nanosleep: work around cygwin bug
Cygwin 1.5.x mistakenly failed with EINVAL for a duration longer
than 49.7 days (2**32 milliseconds).  Meanwhile, the existing
code for HAVE_BUG_BIG_NANOSLEEP would infloop, instead of return
failure, for invalid arguments.

* lib/nanosleep.c (rpl_nanosleep) [HAVE_BUG_BIG_NANOSLEEP]:
Fix logic bug when nanosleep fails.  Work around cygwin 1.5.x
bug.
(getnow): Delete, not needed.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): No longer require
LIB_CLOCK_GETTIME.
* modules/nanosleep (Depends-on): Add intprops and verify.  Drop
clock-time, gettime.
* doc/posix-functions/nanosleep.texi (nanosleep): Document the
bug.
* modules/nanosleep-tests: New test.
* tests/test-nanosleep.c: New file.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-11-20 07:11:28 -07:00
Eric Blake
6baa46639c sleep: work around cygwin bug
On cygwin 1.5.x, sleep amounts larger than 49.7 days (2**32
milliseconds) failed instantly, but with a garbage return
value from uninitialized memory.

* lib/sleep.c (rpl_sleep): Work around the bug.
* m4/sleep.m4 (gl_FUNC_SLEEP): Detect the bug.
(gl_PREREQ_SLEEP): Delete unused macro.
* modules/sleep (Depends-on): Add verify.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default.
* modules/unistd (Makefile.am): Substitute witness.
* lib/unistd.in.h (sleep): Update prototype.
* doc/posix-functions/sleep.texi (sleep): Document the bug.
* tests/test-sleep.c (main) [HAVE_DECL_ALARM]: Test it.
* modules/sleep-tests (Depends-on): Check for alarm.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-11-20 07:10:22 -07:00