Eric Blake [Fri, 30 Oct 2009 16:24:45 +0000 (10:24 -0600)]
vasnprintf: avoid compiler warnings
* lib/vasnprintf.c (VASNPRINTF): Avoid shadowing our own local
variables.
* lib/printf-args.c (PRINTF_FETCHARGS): Avoid type mismatch.
Signed-off-by: Eric Blake <ebb9@byu.net>
Simon Josefsson [Tue, 17 Nov 2009 09:04:43 +0000 (10:04 +0100)]
modules/xalloc-die-tests (Makefile.am): Drop XFAIL_TESTS.
Jim Meyering [Tue, 17 Nov 2009 07:46:29 +0000 (08:46 +0100)]
test-xalloc-die.sh: make the code agree with the commit log
* tests/test-xalloc-die.sh: Put "." at the front of $PATH, not
at the end, just in case you happen to have a test-xalloc-die
program in some other PATH directory.
Jim Meyering [Tue, 17 Nov 2009 07:42:58 +0000 (08:42 +0100)]
test-xalloc-die.sh: fix a portability bug
* tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die.
Instead, set PATH to start with "." and invoke via "test-xalloc-die".
Otherwise, argv[0] (as often seen in diagnostics) would be too
system-dependent, sometimes with, and sometimes without the leading "./".
Jim Meyering [Tue, 17 Nov 2009 06:20:41 +0000 (07:20 +0100)]
version-etc-fsf: relax license to LGPLv3+
* modules/version-etc-fsf (License): Relax license.
Eric Blake [Tue, 17 Nov 2009 04:21:10 +0000 (21:21 -0700)]
xalloc-die-tests: avoid printing null pointer
The test leaked "(null): memory exhausted" to stderr, or crashed
for less capable printf.
* modules/xalloc-die-tests (Files, Makefile.am): Wrap execution in
shell script.
* tests/test-xalloc-die.c (program_name): Declare.
* tests/test-xalloc-die.sh (tmpfiles): New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Ian Beckwith [Tue, 17 Nov 2009 03:48:24 +0000 (03:48 +0000)]
NEWS.stable: update
Jim Meyering [Mon, 16 Nov 2009 21:08:52 +0000 (22:08 +0100)]
version-etc: relax license to LGPLv3+
* modules/version-etc (License): Relax license.
(cherry picked from commit
1c32714559eaa0e6747ae153eff36dc1f97585f9)
Ian Beckwith [Tue, 17 Nov 2009 03:46:55 +0000 (03:46 +0000)]
NEWS.stable: update
Jim Meyering [Mon, 16 Nov 2009 18:26:35 +0000 (19:26 +0100)]
better AC_REQUIRE expanded-before-required-warning avoidance
* m4/chown.m4 (gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Define
with AC_DEFUN_ONCE, rather than AC_DEFUN, to avoid AC_REQUIRE warnings.
Suggested by Eric Blake. This change also reverts commit
1b712ba8,
which is no longer needed.
Ian Beckwith [Tue, 17 Nov 2009 03:41:16 +0000 (03:41 +0000)]
NEWS.stable: update
Eric Blake [Sun, 15 Nov 2009 05:13:10 +0000 (22:13 -0700)]
setenv, unsetenv: work around various bugs
POSIX requires setenv(NULL,"",0), setenv("a=b","",0),
unsetenv(NULL), and unsetenv("a=b") to fail with EINVAL, but
many BSD implementations lack validation. The gnulib
replacement for void unsetenv did not do validation, and the
replacement for setenv was out of sync with glibc. Also, some
BSD implementations of setenv("a","==",1) eat the leading '='.
See also some recent Austin Group interpretations on environ:
http://austingroupbugs.net/view.php?id=167
http://austingroupbugs.net/view.php?id=185
* lib/setenv.c (setenv) [!HAVE_SETENV]: Resync from glibc.
(setenv) [HAVE_SETENV]: Work around bugs.
* lib/unsetenv.c (unsetenv) [HAVE_UNSETENV]: Work around bugs.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE, gl_FUNC_UNSETENV): Check
for bugs.
(gl_FUNC_SETENV): Write in terms of gl_FUNC_SETENV_SEPARATE.
* m4/environ.m4 (gl_ENVIRON): Avoid expand-before-require.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Update defaults.
* modules/stdlib (Makefile.am): Update substitutions.
* lib/stdlib.in.h (setenv, unsetenv): Update prototypes.
* doc/posix-functions/setenv.texi (setenv): Document the bugs.
* doc/posix-functions/unsetenv.texi (unsetenv): Likewise.
* modules/setenv-tests: New test.
* modules/unsetenv-tests: Likewise.
* tests/test-setenv.c: New file.
* tests/test-unsetenv.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Jim Meyering [Mon, 16 Nov 2009 09:22:53 +0000 (10:22 +0100)]
avoid new AC_REQUIRE expanded-before-required warnings
* modules/chown (configure.ac): Require gl_FUNC_CHOWN, rather than
merely using it.
* modules/euidaccess (configure.ac): Likewise for gl_FUNC_EUIDACCESS.
* modules/faccessat (configure.ac): Likewise for gl_FUNC_FACCESSAT.
(cherry picked from commit
1b712ba8bb1359974aa495a1a95b2185ed68e87e)
Ian Beckwith [Tue, 17 Nov 2009 03:24:18 +0000 (03:24 +0000)]
NEWS.stable: update
Simon Josefsson [Sun, 15 Nov 2009 12:52:55 +0000 (13:52 +0100)]
lib/gc-pbkdf2-sha1.c: Remove comments from RFC 2898.
(cherry picked from commit
24a6641b053b7fc8bf13b4149722e85d77db9920)
Jim Meyering [Mon, 16 Nov 2009 21:08:52 +0000 (22:08 +0100)]
version-etc: relax license to LGPLv3+
* modules/version-etc (License): Relax license.
Jim Meyering [Mon, 16 Nov 2009 18:26:35 +0000 (19:26 +0100)]
better AC_REQUIRE expanded-before-required-warning avoidance
* m4/chown.m4 (gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Define
with AC_DEFUN_ONCE, rather than AC_DEFUN, to avoid AC_REQUIRE warnings.
Suggested by Eric Blake. This change also reverts commit
1b712ba8,
which is no longer needed.
Eric Blake [Mon, 16 Nov 2009 13:27:10 +0000 (06:27 -0700)]
test-freading: clean up temporary file
* tests/test-freading.c (main): Remove file on success, and use
ASSERT more liberally.
Reported by Jim Meyering.
Signed-off-by: Eric Blake <ebb9@byu.net>
Jim Meyering [Mon, 16 Nov 2009 09:22:53 +0000 (10:22 +0100)]
avoid new AC_REQUIRE expanded-before-required warnings
* modules/chown (configure.ac): Require gl_FUNC_CHOWN, rather than
merely using it.
* modules/euidaccess (configure.ac): Likewise for gl_FUNC_EUIDACCESS.
* modules/faccessat (configure.ac): Likewise for gl_FUNC_FACCESSAT.
Simon Josefsson [Sun, 15 Nov 2009 16:20:06 +0000 (17:20 +0100)]
Add xalloc-die self-test.
Simon Josefsson [Sun, 15 Nov 2009 12:52:55 +0000 (13:52 +0100)]
lib/gc-pbkdf2-sha1.c: Remove comments from RFC 2898.
Ian Beckwith [Sun, 15 Nov 2009 03:45:13 +0000 (03:45 +0000)]
NEWS.stable: update
Eric Blake [Sat, 14 Nov 2009 22:25:49 +0000 (15:25 -0700)]
fnmatch: avoid compiler warning
cond ? (size_t) : (char* - char* + 1) varies in signedness, but
using 1LU coerces the latter half to unsigned math.
* lib/fnmatch_loop.c (NEW_PATTERN): Coerce addition to unsigned,
to silence compiler warning about mismatch signedness in ?:.
Reported by Robert Millan.
Signed-off-by: Eric Blake <ebb9@byu.net>
Robert Millan [Sat, 14 Nov 2009 13:45:02 +0000 (06:45 -0700)]
gnulib-tool: correctly detect absence of m4 directories
$m4dirs is incorrectly counting. In my particular case
(correct value: 0, detected value: 1), this resulted in gnulib-tool
silently exitting with no visible error (and no job done).
* gnulib-tool: Avoid extra newline on data passed to wc -l.
Signed-off-by: Eric Blake <ebb9@byu.net>
John W. Eaton [Sat, 14 Nov 2009 07:24:25 +0000 (08:24 +0100)]
strftime.h: wrap funtion declaration in extern "C" block
* lib/strftime.h (nstrftime) [__cplusplus]: Wrap declaration.
(cherry picked from commit
ee8909a98bbfffc6317e1e9273e1cb8d6341ea25)
Eric Blake [Fri, 13 Nov 2009 20:31:35 +0000 (13:31 -0700)]
getgroups: avoid compiler warning
* lib/getgroups.c (rpl_getgroups): Delete shadowed variable.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
cf0c4abc71ea50e9b9dc511bde1e4f1c1face4d4)
Eric Blake [Fri, 13 Nov 2009 19:53:17 +0000 (12:53 -0700)]
getgroups: work around FreeBSD bug
FreeBSD 7.2 mistakenly succeeds on getgroups(-1,ptr) (POSIX
requires EINVAL failure since -1 is less than the proper result).
* lib/getgroups.c (rpl_getgroups): Work around the bug.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Detect the bug.
* doc/posix-functions/getgroups.texi (getgroups): Document it.
* tests/test-getgroups.c (main): Fix buffer overrun.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Fri, 13 Nov 2009 16:06:14 +0000 (09:06 -0700)]
getgroups: avoid compilation failure
* lib/getgroups.c (includes): Include <stdint.h> for SIZE_MAX.
* modules/getgroups (Depends-on): Add stdint.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
f3a2c4aaa9ad3ed11c1437cdce8ae172fd273a1f)
Jim Meyering [Fri, 13 Nov 2009 15:15:23 +0000 (16:15 +0100)]
test-getgroups: avoid compilation failure
* tests/test-getgroups.c: Include <stdint.h> for use of SIZE_MAX.
(cherry picked from commit
0173b1e598b66fc95f4cf3af023313e29701e384)
Eric Blake [Thu, 12 Nov 2009 16:53:14 +0000 (09:53 -0700)]
getgroups, getugroups: provide stubs for mingw
Avoid link failure on mingw, which lacks getgroups and anything
else related to gid_t management (stat.st_gid is always 0).
* lib/getgroups.c (getgroups): Provide ENOSYS stub for mingw.
* lib/getugroups.c (getugroups): Likewise.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Check for missing
function. Modernize replacement scheme.
(gl_PREREQ_GETGROUPS): Delete.
* m4/getugroups.m4 (gl_GETUGROUPS): Check for <grp.h>.
* modules/getgroups (configure.ac): Declare witness.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default.
* modules/unistd (Depends-on): Substitute witness.
* lib/unistd.in.h (getgroups): Declare replacement.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
61b3a42219dc8f575923346b59162f81186b7425)
Eric Blake [Thu, 12 Nov 2009 16:30:38 +0000 (09:30 -0700)]
getgroups: avoid calling exit
rpl_getgroups should be a library function, comparable to glibc.
* modules/getgroups (Depends-on): Add malloc-posix and unistd,
drop xalloc.
* modules/getgroups-tests (Depends-on, Makefile.am): Drop unneeded
dependencies.
* lib/getgroups.c (rpl_getgroups): Fail with ENOMEM rather than
exiting, in the rare case of malloc failure.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
80074d103cc72ea8f289b82c56bd3734aac82cd7)
Eric Blake [Thu, 12 Nov 2009 15:51:45 +0000 (08:51 -0700)]
getgroups: fix logic error
The replacement getgroups mistakenly failed with EINVAL if there
were more than 20 groups, since -1 < n_groups. Also, realloc
geometrically rather than linearly.
* lib/getgroups.c (rpl_getgroups): Don't fail if current process
has more than 20 groups.
* modules/getgroups-tests: New test.
* tests/test-getgroups.c: New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Kamil Dudka [Tue, 10 Nov 2009 13:26:56 +0000 (14:26 +0100)]
fts: do not fail on a submount during traversal
* lib/fts.c (fts_build): Read the stat info again after opening
a directory if the FTS_TIGHT_CYCLE_CHECK flag is set.
Original report at http://bugzilla.redhat.com/501848.
(cherry picked from commit
ac67780e88411e8fcb94cda0a9e0a9abab6f8369)
Jim Meyering [Thu, 12 Nov 2009 08:42:52 +0000 (09:42 +0100)]
bootstrap: generalize autoheader check
* build-aux/bootstrap: Look for AC_CONFIG_HEADER as well as
AC_CONFIG_HEADERS.
(cherry picked from commit
7127847e1d16e94fec7422e637debeed24092c0f)
Eric Blake [Wed, 11 Nov 2009 13:34:02 +0000 (06:34 -0700)]
readlink: detect FreeBSD bug
readlink("link-to-symlink/",buf,len) mistakenly read the contents
of "symlink", rather than failing.
* m4/readlink.m4 (gl_FUNC_READLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/readlink.texi (readlink): Document the bug.
* tests/test-readlink.h (test_readlink): Enhance test.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
dfd4d11c50dd4729bf46c26a3bbdda0c6031409d)
Eric Blake [Tue, 10 Nov 2009 14:59:39 +0000 (07:59 -0700)]
symlink: detect FreeBSD bug
symlink(name,"dangling/") mistakenly created a symlink at the
target of "dangling".
* m4/symlink.m4 (gl_FUNC_SYMLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/symlink.texi (symlink): Document the bug.
* tests/test-symlink.h (test_symlink): Enhance test.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
24a6037afaa234252b05719df819e6645ec92697)
Eric Blake [Mon, 9 Nov 2009 21:23:11 +0000 (14:23 -0700)]
link: detect FreeBSD bug
link("link-to-file/","a") mistakenly created "a" as a link to "file".
* m4/link.m4 (gl_FUNC_LINK): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/link.texi (link): Document the bug.
* tests/test-link.h (test_link): Enhance test.
* tests/test-linkat.c (main): Update caller.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
492960c3a5eaaae32cd9d69d6fd5d7fdf96cbb78)
Eric Blake [Mon, 9 Nov 2009 17:44:08 +0000 (10:44 -0700)]
unlink, remove: detect FreeBSD bug
unlink("link-to-file/") mistakenly removed "file".
* m4/unlink.m4 (gl_FUNC_UNLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/unlink.texi (unlink): Document the bug.
* doc/posix-functions/remove.texi (remove): Likewise.
* tests/test-unlink.h (test_unlink): Enhance test.
* tests/test-remove.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
24208770c8721323060207c9be83dd24400678d3)
Karl Berry [Mon, 9 Nov 2009 14:10:03 +0000 (06:10 -0800)]
Eric Blake [Mon, 9 Nov 2009 01:11:50 +0000 (18:11 -0700)]
rename: detect FreeBSD bug
rename("link-to-file/","new") mistakenly succeeded.
* m4/rename.m4 (gl_FUNC_RENAME): Also detect FreeBSD bug with
slash on symlink.
* modules/renameat-tests (Depends-on): Add filenamecat.
* tests/test-rename.h (test_rename): Allow one more errno.
* tests/test-renameat.c (main): Likewise.
* doc/posix-functions/rename.texi (rename): Document the bug.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
d462fe1752f26b281d2627e5e151c70341dc6d33)
Eric Blake [Sun, 8 Nov 2009 04:34:32 +0000 (21:34 -0700)]
open: detect FreeBSD bug
open("link-to-file/", O_RDONLY) mistakenly succeeds. The previous
patch was enough to fix utimens when no fd is involved, but this is
necessary for futimens to pass.
* m4/open.m4 (gl_FUNC_OPEN): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/open.texi (open): Document the bug.
* doc/posix-functions/utimes.texi (utimes): Likewise.
* tests/test-open.h (test_open): Add parameters, and test symlink
handling.
* tests/test-open.c (main): Adjust caller.
* tests/test-fcntl-safer.c (main): Likewise.
* modules/open-tests (Depends-on): Add stdbool, symlink.
* modules/fcntl-safer-tests (Depends-on): Likewise.
* tests/test-openat.c (main): Add test-open tests.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
48e988340f85e568ceb9ac1f4bf5824fddf1fd0d)
Eric Blake [Sat, 7 Nov 2009 23:59:11 +0000 (16:59 -0700)]
stat: detect FreeBSD bug
Like Solaris 9, FreeBSD 7.2 mistakenly allows stat("link-to-file/").
Unlike Solaris, it correctly forbids stat("file/"). A number of
interfaces are affected (such as utimes), but replacing stat is
enough to catch several by reusing the Solaris 9 fixes.
* m4/stat.m4 (gl_FUNC_STAT): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/stat.texi (stat): Document the bug.
* tests/test-stat.h (test_stat_func): Add argument.
* tests/test-stat.c (main): Adjust caller.
* tests/test-fstatat.c (main): Likewise.
* modules/stat-tests (Depends-on): Add stdbool, symlink.
Reported by Jim Meyering.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit
349396ebfcce12ee8f927fedf82067414c427093)
James Youngman [Mon, 9 Nov 2009 10:41:29 +0000 (11:41 +0100)]
strftime.c: include ignore-value.h only when FPRINTFTIME is defined
* lib/strftime.c: Correct placement of #include "ignore-value.h".
(cherry picked from commit
6553be82a4a522e50ece1a430e82a9b1dfd0f471)
Jim Meyering [Sun, 8 Nov 2009 11:09:35 +0000 (12:09 +0100)]
utimens: remove invalid futimesat call
* lib/utimens.c (fdutimens) [HAVE_FUTIMESAT]: Remove invalid futimesat
call. It used the file descriptor of the target file as the DIR_FD
parameter and NULL as the file name. That caused failure with
errno == EFAULT on FreeBSD-8.0-rc2.
(cherry picked from commit
26c5fd742f9136e2ddbd4695a9172c3fa30ea260)
Ian Beckwith [Sun, 15 Nov 2009 02:39:59 +0000 (02:39 +0000)]
NEWS.stable: initial version
Eric Blake [Sat, 14 Nov 2009 22:25:49 +0000 (15:25 -0700)]
fnmatch: avoid compiler warning
cond ? (size_t) : (char* - char* + 1) varies in signedness, but
using 1LU coerces the latter half to unsigned math.
* lib/fnmatch_loop.c (NEW_PATTERN): Coerce addition to unsigned,
to silence compiler warning about mismatch signedness in ?:.
Reported by Robert Millan.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Sat, 14 Nov 2009 22:09:08 +0000 (15:09 -0700)]
intprops: add double-inclusion guard
* lib/intprops.h: Allow idempotent includes.
Suggested by Bruce Korb.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Sat, 14 Nov 2009 15:17:44 +0000 (08:17 -0700)]
openat: detect Solaris fchownat bug
Solaris 9 fchownat(dir,"name/",uid,gid,flag) has same bugs as
chown and lchown.
* lib/fchownat.c (rpl_fchownat): Work around Solaris bug. Avoid
penalizing glibc chownat when only lchownat is broken.
* m4/openat.m4 (gl_FUNC_FCHOWNAT): Replace fchownat if there are
trailing slash bugs.
* doc/posix-functions/fchownat.texi (fchownat): Document the bug.
* modules/openat-tests (Files): Include more files.
(Depends-on): Add mgetgroups, sleep, stat-time.
(configure.ac): Add additional checks.
(Makefile.am): Build new test.
* tests/test-fchownat.c: New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Fri, 13 Nov 2009 04:45:20 +0000 (21:45 -0700)]
lchown: detect Solaris and FreeBSD bug
Solaris 9 and FreeBSD 7.2 lchown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".
* lib/lchown.c (rpl_lchown): Work around bug.
* m4/lchown.m4 (gl_FUNC_LCHOWN): Check for trailing slash bugs.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (lchown): Update declaration.
* doc/posix-functions/lchown.texi (lchown): Document the bug.
* modules/lchown-tests: New file.
* tests/test-lchown.h (test_lchown): Likewise.
* tests/test-lchown.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Fri, 13 Nov 2009 04:45:20 +0000 (21:45 -0700)]
chown: detect Solaris and FreeBSD bug
Solaris 9 and FreeBSD 7.2 chown("link-to-file/",uid,gid)
mistakenly changes ownership of "file".
* lib/chown.c (rpl_chown): Work around bug.
* m4/chown.m4 (gl_FUNC_CHOWN): Check for trailing slash bugs.
(gl_PREREQ_CHOWN): Delete.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Populate it.
* lib/unistd.in.h (chown): Update declaration.
* lib/lchown.c (chown): Update client.
* modules/lchown (Depends-on): Add lstat.
* doc/posix-functions/chown.texi (chown): Document the bug.
* doc/posix-functions/getgroups.texi (getgroups): Document
getgroups pitfall.
* modules/chown-tests: New file.
* tests/test-chown.h (test_chown): Likewise.
* tests/test-chown.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Robert Millan [Sat, 14 Nov 2009 13:45:02 +0000 (06:45 -0700)]
gnulib-tool: correctly detect absence of m4 directories
$m4dirs is incorrectly counting. In my particular case
(correct value: 0, detected value: 1), this resulted in gnulib-tool
silently exitting with no visible error (and no job done).
* gnulib-tool: Avoid extra newline on data passed to wc -l.
Signed-off-by: Eric Blake <ebb9@byu.net>
Jim Meyering [Sat, 14 Nov 2009 08:53:26 +0000 (09:53 +0100)]
maint.mk: Prohibit inclusion of "xalloc.h" without use.
* top/maint.mk (sc_prohibit_close_stream_without_use): New rule.
John W. Eaton [Sat, 14 Nov 2009 07:24:25 +0000 (08:24 +0100)]
strftime.h: wrap funtion declaration in extern "C" block
* lib/strftime.h (nstrftime) [__cplusplus]: Wrap declaration.
Eric Blake [Fri, 13 Nov 2009 20:31:35 +0000 (13:31 -0700)]
getgroups: avoid compiler warning
* lib/getgroups.c (rpl_getgroups): Delete shadowed variable.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Fri, 13 Nov 2009 19:53:17 +0000 (12:53 -0700)]
getgroups: work around FreeBSD bug
FreeBSD 7.2 mistakenly succeeds on getgroups(-1,ptr) (POSIX
requires EINVAL failure since -1 is less than the proper result).
* lib/getgroups.c (rpl_getgroups): Work around the bug.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Detect the bug.
* doc/posix-functions/getgroups.texi (getgroups): Document it.
* tests/test-getgroups.c (main): Fix buffer overrun.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Fri, 13 Nov 2009 16:06:14 +0000 (09:06 -0700)]
getgroups: avoid compilation failure
* lib/getgroups.c (includes): Include <stdint.h> for SIZE_MAX.
* modules/getgroups (Depends-on): Add stdint.
Signed-off-by: Eric Blake <ebb9@byu.net>
Jim Meyering [Fri, 13 Nov 2009 15:15:23 +0000 (16:15 +0100)]
test-getgroups: avoid compilation failure
* tests/test-getgroups.c: Include <stdint.h> for use of SIZE_MAX.
Eric Blake [Thu, 12 Nov 2009 18:31:52 +0000 (11:31 -0700)]
mgetgroups: new module, taken from coreutils
Wrapper function that makes using getgroups/getugroups easier to use.
As part of the move from coreutils, convert GETGROUPS_T to gid_t,
and allow mgetgroups(NULL,getegid(),&list) as a way to ensure that
the effective gid is in the list.
* modules/mgetgroups: New file.
* lib/mgetgroups.h: Likewise.
* lib/mgetgroups.c (mgetgroups): Likewise.
* m4/mgetgroups.m4 (gl_MGETGROUPS): Likewise.
* MODULES.html.sh (Users and groups): Mention it.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Thu, 12 Nov 2009 17:19:39 +0000 (10:19 -0700)]
getgroups: don't expose GETGROUPS_T to user
These days, most systems already declare getgroups with gid_t*.
But in the rare case that GETGROUPS_T is still int but gid_t
is short, the user should not have to uglify their code; let
the replacement hide all the magic.
Tested by configuring with ac_cv_type_getgroups=uint64_t on a
platform with 32-bit gid_t, and ignoring compiler warnings.
However, since we don't replace setgroups, the GETGROUPS_T
workaround is still needed there for now.
* lib/getgroups.c (rpl_getgroups): Change signature. Copy array
an element at a time if GETGROUPS_T is wrong size.
* lib/getugroups.h (getugroups): Change signature.
* lib/unistd.in.h (getgroups): Likewise.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Use replacement if
signature needs fixing.
* m4/getugroups.m4 (gl_GETUGROUPS): No longer need
AC_TYPE_GETGROUPS.
* modules/group-member (Depends-on): Add getgroups.
* lib/group-member.c (group_info, get_group_info): Use gid_t.
(group_member): Rely on getgroups replacement.
* lib/getugroups.c (getugroups): Use gid_t.
* tests/test-getgroups.c (main): Likewise.
* NEWS: Mention the signature change.
* doc/posix-functions/getgroups.texi (getgroups): Mention the
problem with signature.
* doc/glibc-functions/setgroups.texi (setgroups): Mention that
GETGROUPS_T is still useful for setgroups.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Thu, 12 Nov 2009 16:53:14 +0000 (09:53 -0700)]
getgroups, getugroups: provide stubs for mingw
Avoid link failure on mingw, which lacks getgroups and anything
else related to gid_t management (stat.st_gid is always 0).
* lib/getgroups.c (getgroups): Provide ENOSYS stub for mingw.
* lib/getugroups.c (getugroups): Likewise.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Check for missing
function. Modernize replacement scheme.
(gl_PREREQ_GETGROUPS): Delete.
* m4/getugroups.m4 (gl_GETUGROUPS): Check for <grp.h>.
* modules/getgroups (configure.ac): Declare witness.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default.
* modules/unistd (Depends-on): Substitute witness.
* lib/unistd.in.h (getgroups): Declare replacement.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Thu, 12 Nov 2009 16:30:38 +0000 (09:30 -0700)]
getgroups: avoid calling exit
rpl_getgroups should be a library function, comparable to glibc.
* modules/getgroups (Depends-on): Add malloc-posix and unistd,
drop xalloc.
* modules/getgroups-tests (Depends-on, Makefile.am): Drop unneeded
dependencies.
* lib/getgroups.c (rpl_getgroups): Fail with ENOMEM rather than
exiting, in the rare case of malloc failure.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Thu, 12 Nov 2009 15:51:45 +0000 (08:51 -0700)]
getgroups: fix logic error
The replacement getgroups mistakenly failed with EINVAL if there
were more than 20 groups, since -1 < n_groups. Also, realloc
geometrically rather than linearly.
* lib/getgroups.c (rpl_getgroups): Don't fail if current process
has more than 20 groups.
* modules/getgroups-tests: New test.
* tests/test-getgroups.c: New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Simon Josefsson [Fri, 13 Nov 2009 14:00:59 +0000 (15:00 +0100)]
Drop redundant string.h (silent change).
Suggested by Eric Blake <ebb9@byu.net>.
Simon Josefsson [Fri, 13 Nov 2009 13:25:50 +0000 (14:25 +0100)]
test-base64: Improve.
Simon Josefsson [Fri, 13 Nov 2009 12:53:01 +0000 (13:53 +0100)]
tests/test-xvasprintf.c: Fix memory leak.
Simon Josefsson [Fri, 13 Nov 2009 09:53:06 +0000 (10:53 +0100)]
test-xvasprintf: Add %s%s related checks.
Eric Blake [Mon, 9 Nov 2009 22:18:13 +0000 (15:18 -0700)]
version-etc: match standards.texi style
This assumes that PACKAGE_BUGREPORTS and PACKAGE_PACKAGER_BUG_REPORTS
are generally email addresses, not URLs.
Coreutils switched to a similar style on 2009-02-01, with no complaints
(the difference is that coreutils inserts the program name, derived
from argv[0], into the bug reporting line). Around that time,
standards.texi was also updated to mention this style.
* lib/version-etc.c (emit_bug_reporting_address): Drop periods,
and use <> only for URLs.
Signed-off-by: Eric Blake <ebb9@byu.net>
Kamil Dudka [Tue, 10 Nov 2009 13:26:56 +0000 (14:26 +0100)]
fts: do not fail on a submount during traversal
* lib/fts.c (fts_build): Read the stat info again after opening
a directory if the FTS_TIGHT_CYCLE_CHECK flag is set.
Original report at http://bugzilla.redhat.com/501848.
Jim Meyering [Thu, 12 Nov 2009 08:49:39 +0000 (09:49 +0100)]
bootstrap: sync from coreutils
* build-aux/bootstrap (bootstrap_epilogue): New function.
Use git_modules_config in one more place. This make bootstrap's
--gnulib-srcdir option more useful for testing.
Jim Meyering [Thu, 12 Nov 2009 08:42:52 +0000 (09:42 +0100)]
bootstrap: generalize autoheader check
* build-aux/bootstrap: Look for AC_CONFIG_HEADER as well as
AC_CONFIG_HEADERS.
Eric Blake [Wed, 11 Nov 2009 21:22:44 +0000 (14:22 -0700)]
mkfifoat: use new modules for Solaris and BSD bugs
Pick up Solaris 9 and BSD fixes to mkfifo and mknod. No known
system has mknodat but broken mknod, so there is no need for
rpl_mkfifoat or rpl_mknodat. Split mknodat into its own file.
* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Simplify.
* lib/mkfifoat.c (mknodat): Split...
* lib/mknodat.c (mknodat): ...into new file.
* modules/mkfifoat (Files): Ship new file.
(Depends-on): Add mkfifo, mknod.
* modules/mkfifoat-tests (Files): Reuse mkfifo tests.
(Depends-on): Add symlink.
* tests/test-mkfifoat.c (main): Enhance test. Drop portions now
redundant with test_mkfifo.h.
(do_mkfifoat, do_mknodat): New helpers.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Wed, 11 Nov 2009 20:23:04 +0000 (13:23 -0700)]
mknod: new module
Solaris 9 mknod("name/",mode,dev) mistakenly creates "name" for
non-directory mode. FreeBSD 7.2 mknod("dangling/",mode,dev)
mistakenly creates the target of the symlink if run as root.
FreeBSD and OpenBSD mknod("fifo",S_IFIFO|mode,0) fails for non-root.
Use of mknod caused link failures on mingw.
* modules/mknod: New file.
* m4/mknod.m4 (gl_FUNC_MKNOD): Likewise.
* lib/mknod.c (mknod): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Set witness
defaults.
* modules/sys_stat (Makefile.am): Substitute them.
* lib/sys_stat.in.h (mknod): Declare replacement.
* MODULES.html.sh (Support for systems lacking POSIX:2008):
Document it.
* doc/posix-functions/mknod.texi (mknod): Likewise.
* modules/mknod-tests: New test.
* tests/test-mknod.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Wed, 11 Nov 2009 20:22:04 +0000 (13:22 -0700)]
mkfifo: new module
Solaris 9 mkfifo("name/",mode) mistakenly creates "name".
FreeBSD 7.2 mkfifo("dangling/",mode) mistakenly creates a fifo
at the target of "dangling". Mingw lacks named pipes altogether,
but this at least avoids link failures.
* modules/mkfifo: New file.
* m4/mkfifo.m4 (gl_FUNC_MKFIFO): Likewise.
* lib/mkfifo.c (mkfifo): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Set witness
defaults.
* modules/sys_stat (Makefile.am): Substitute them.
* lib/sys_stat.in.h (mkfifo): Declare replacement.
* MODULES.html.sh (Support for systems lacking POSIX:2008):
Document it.
* doc/posix-functions/mkfifo.texi (mkfifo): Likewise.
* modules/mkfifo-tests: New test.
* tests/test-mkfifo.h (test_mkfifo): New file, borrowed in part
from test-mkfifoat.c.
* tests/test-mkfifo.c: New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Wed, 11 Nov 2009 13:34:02 +0000 (06:34 -0700)]
readlink: detect FreeBSD bug
readlink("link-to-symlink/",buf,len) mistakenly read the contents
of "symlink", rather than failing.
* m4/readlink.m4 (gl_FUNC_READLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/readlink.texi (readlink): Document the bug.
* tests/test-readlink.h (test_readlink): Enhance test.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Tue, 10 Nov 2009 14:59:39 +0000 (07:59 -0700)]
symlink: detect FreeBSD bug
symlink(name,"dangling/") mistakenly created a symlink at the
target of "dangling".
* m4/symlink.m4 (gl_FUNC_SYMLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/symlink.texi (symlink): Document the bug.
* tests/test-symlink.h (test_symlink): Enhance test.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Mon, 9 Nov 2009 21:23:11 +0000 (14:23 -0700)]
link: detect FreeBSD bug
link("link-to-file/","a") mistakenly created "a" as a link to "file".
* m4/link.m4 (gl_FUNC_LINK): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/link.texi (link): Document the bug.
* tests/test-link.h (test_link): Enhance test.
* tests/test-linkat.c (main): Update caller.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Mon, 9 Nov 2009 17:44:08 +0000 (10:44 -0700)]
unlink, remove: detect FreeBSD bug
unlink("link-to-file/") mistakenly removed "file".
* m4/unlink.m4 (gl_FUNC_UNLINK): Also detect FreeBSD bug with
slash on symlink.
* doc/posix-functions/unlink.texi (unlink): Document the bug.
* doc/posix-functions/remove.texi (remove): Likewise.
* tests/test-unlink.h (test_unlink): Enhance test.
* tests/test-remove.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Karl Berry [Mon, 9 Nov 2009 14:10:03 +0000 (06:10 -0800)]
autoupdate
Eric Blake [Mon, 9 Nov 2009 01:11:50 +0000 (18:11 -0700)]
rename: detect FreeBSD bug
rename("link-to-file/","new") mistakenly succeeded.
* m4/rename.m4 (gl_FUNC_RENAME): Also detect FreeBSD bug with
slash on symlink.
* modules/renameat-tests (Depends-on): Add filenamecat.
* tests/test-rename.h (test_rename): Allow one more errno.
* tests/test-renameat.c (main): Likewise.
* doc/posix-functions/rename.texi (rename): Document the bug.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Sun, 8 Nov 2009 04:34:32 +0000 (21:34 -0700)]
open: detect FreeBSD bug
open("link-to-file/", O_RDONLY) mistakenly succeeds. The previous
patch was enough to fix utimens when no fd is involved, but this is
necessary for futimens to pass.
* m4/open.m4 (gl_FUNC_OPEN): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/open.texi (open): Document the bug.
* doc/posix-functions/utimes.texi (utimes): Likewise.
* tests/test-open.h (test_open): Add parameters, and test symlink
handling.
* tests/test-open.c (main): Adjust caller.
* tests/test-fcntl-safer.c (main): Likewise.
* modules/open-tests (Depends-on): Add stdbool, symlink.
* modules/fcntl-safer-tests (Depends-on): Likewise.
* tests/test-openat.c (main): Add test-open tests.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Sat, 7 Nov 2009 23:59:11 +0000 (16:59 -0700)]
stat: detect FreeBSD bug
Like Solaris 9, FreeBSD 7.2 mistakenly allows stat("link-to-file/").
Unlike Solaris, it correctly forbids stat("file/"). A number of
interfaces are affected (such as utimes), but replacing stat is
enough to catch several by reusing the Solaris 9 fixes.
* m4/stat.m4 (gl_FUNC_STAT): Also detect FreeBSD bug with slash on
symlink.
* doc/posix-functions/stat.texi (stat): Document the bug.
* tests/test-stat.h (test_stat_func): Add argument.
* tests/test-stat.c (main): Adjust caller.
* tests/test-fstatat.c (main): Likewise.
* modules/stat-tests (Depends-on): Add stdbool, symlink.
Reported by Jim Meyering.
Signed-off-by: Eric Blake <ebb9@byu.net>
James Youngman [Mon, 9 Nov 2009 10:41:29 +0000 (11:41 +0100)]
strftime.c: include ignore-value.h only when FPRINTFTIME is defined
* lib/strftime.c: Correct placement of #include "ignore-value.h".
Jim Meyering [Sun, 8 Nov 2009 11:09:35 +0000 (12:09 +0100)]
utimens: remove invalid futimesat call
* lib/utimens.c (fdutimens) [HAVE_FUTIMESAT]: Remove invalid futimesat
call. It used the file descriptor of the target file as the DIR_FD
parameter and NULL as the file name. That caused failure with
errno == EFAULT on FreeBSD-8.0-rc2.
Eric Blake [Sat, 7 Nov 2009 23:03:38 +0000 (16:03 -0700)]
fflush, freadseek: use fseeko, not fseek
Follow our own advice: fseek is not safe to use on large files.
* lib/fflush.c (clear_ungetc_buffer_preserving_position)
(clear_ungetc_buffer): Avoid potential problems on large files.
* lib/freadseek.c (freadseek): Likewise.
* modules/freadseek (Depends-on): Add fseeko.
* modules/fseek (configure.ac): Set a witness.
* tests/test-fflush.c (main): Use fseeko.
* tests/test-fpurge.c (fseek): Disable link warning.
* tests/test-freadable.c (fseek): Likewise.
* tests/test-freading.c (fseek): Likewise.
* tests/test-fseeko.c (fseek): Likewise.
* tests/test-ftell.c (fseek): Likewise.
* tests/test-ftello.c (fseek): Likewise.
* tests/test-fwritable.c (fseek): Likewise.
* tests/test-fwriting.c (fseek): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Karl Berry [Sat, 7 Nov 2009 14:19:36 +0000 (06:19 -0800)]
autoupdate
Simon Josefsson [Fri, 6 Nov 2009 13:37:15 +0000 (14:37 +0100)]
modules/memchr (Depends-on): Drop getpagesize dependency.
Simon Josefsson [Fri, 6 Nov 2009 13:36:24 +0000 (14:36 +0100)]
build-aux/pmccabe2html: Drop #! header. Doc fix.
Simon Josefsson [Fri, 6 Nov 2009 13:30:03 +0000 (14:30 +0100)]
build-aux/pmccabe2html: Disable execute bit. Improve example usage.
Jim Meyering [Fri, 6 Nov 2009 10:01:31 +0000 (11:01 +0100)]
do-release-commit-and-tag: New module.
Automate the release-commit and tag process.
* build-aux/do-release-commit-and-tag: New script, from coreutils.
* modules/do-release-commit-and-tag: New file.
* MODULES.html.sh (Support for maintaining and releasing): Add it.
Simon Josefsson [Fri, 6 Nov 2009 09:01:57 +0000 (10:01 +0100)]
modules/select-tests (test_select_LDADD): Add $(INET_PTON_LIB).
Simon Josefsson [Fri, 6 Nov 2009 07:41:12 +0000 (08:41 +0100)]
getaddrinfo: Simplify Link: directive.
Eric Blake [Fri, 6 Nov 2009 03:48:01 +0000 (20:48 -0700)]
strtod: detect darwin bug
* m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(".
Reported by Leo Davis.
Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake [Thu, 5 Nov 2009 22:13:00 +0000 (15:13 -0700)]
freopen-safer: new module
* modules/freopen-safer: New module.
* m4/stdio-safer.m4 (gl_FREOPEN_SAFER): New macro.
* lib/freopen-safer.c (freopen_safer): New file.
* lib/stdio-safer.h (freopen_safer): New declaration.
* lib/stdio--.h (freopen): New override.
* MODULES.html.sh (File stream based Input/Output): Mention it.
* doc/posix-functions/freopen.texi (freopen): Mention pitfalls and
freopen-safer module.
* doc/posix-functions/stderr.texi (stderr): Likewise.
* doc/posix-functions/stdin.texi (stdin): Likewise.
* doc/posix-functions/stdout.texi (stdout): Likewise.
* modules/freopen-safer-tests: New test.
* tests/test-reopen-safer.c: New file.
Signed-off-by: Eric Blake <ebb9@byu.net>
Jim Meyering [Thu, 5 Nov 2009 17:26:32 +0000 (18:26 +0100)]
maint.mk: Prohibit inclusion of "close-stream.h" without use.
* top/maint.mk (sc_prohibit_close_stream_without_use): New rule.
Simon Josefsson [Thu, 5 Nov 2009 15:43:08 +0000 (16:43 +0100)]
modules/pmccabe2html (configure.ac): Check for pmccabe tool.
Simon Josefsson [Thu, 5 Nov 2009 14:27:35 +0000 (15:27 +0100)]
getaddrinfo (Link): Add $(INET_NTOP_LIB).
Simon Josefsson [Thu, 5 Nov 2009 14:05:18 +0000 (15:05 +0100)]
Fix typo in last commit.
Simon Josefsson [Thu, 5 Nov 2009 13:42:03 +0000 (14:42 +0100)]
inet_ntop, inet_pton: Fix link error.
Simon Josefsson [Thu, 5 Nov 2009 13:38:10 +0000 (14:38 +0100)]
test-func.c: Also test value of __func__.
Simon Josefsson [Thu, 5 Nov 2009 12:54:32 +0000 (13:54 +0100)]
test-sys_socket: Fix compilation warning.