gnulib.git
14 years agosame-inode: make SAME_INODE tri-state, to port to mingw
Eric Blake [Wed, 23 Sep 2009 20:51:29 +0000 (14:51 -0600)]
same-inode: make SAME_INODE tri-state, to port to mingw

Mingw has the annoying habit (already documented in
doc/posix-functions/*stat) that st_ino is always 0.
This means that naive uses of SAME_INODE(a,b) would
succeed, even on distinct files.

Here's an analysis of all gnulib modules that used
the macro before this commit:

chdir-safer is safe - SAME_INODE protected by HAVE_READLINK
cycle-check - mingw has no dir hard links and no symlinks,
 so no directory cycles can occur, and we should ignore -1
fts - SAME_INODE protected by FTS_DEBUG
hash-triple - using -1 gives more hash collisions, but
 the results are still correct
openat-proc - SAME_INODE protected by stat("/proc/self")
same - no dir cycles, so files are only same with identical name
link-follow.m4 - configure test already correct on mingw
test-canonicalize* - test already passes on mingw
test-[l]stat - test already passes on mingw

* NEWS: Mention this change.
* lib/same-inode.h (same-inode.h): Recognize mingw limitation of
st_ino always being 0.
* lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
* lib/cycle-check.c (cycle_check): Likewise.
* lib/same.c (same_name): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolstat: avoid mingw compilation error
Eric Blake [Wed, 23 Sep 2009 20:13:00 +0000 (14:13 -0600)]
lstat: avoid mingw compilation error

The openat module required lstat, but then repeated the checks
for whether lstat worked.  When cross-compiling to mingw, this
led to a wrong answer and tried compiling lstat.c, even though it
was not necessary, with a result of a compiler warning about
undeclared lstat.

* m4/lstat.m4 (gl_FUNC_LSTAT): Avoid duplicate calls to
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, and deal with missing
lstat ourselves.
* lib/lstat.c [!HAVE_LSTAT]: Do nothing if <sys/stat.h> override
was adequate.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Let lstat module handle
the checks for lstat.
(gl_SYS_STAT_H_DEFAULTS): Set default for HAVE_LSTAT.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoautoupdate
Karl Berry [Wed, 23 Sep 2009 13:42:37 +0000 (06:42 -0700)]
autoupdate

14 years agolink: fix test failure on Solaris 9
Eric Blake [Wed, 23 Sep 2009 12:10:36 +0000 (06:10 -0600)]
link: fix test failure on Solaris 9

link("file/",name) mistakenly succeeded.

* lib/link.c (rpl_link): Don't assume link will catch bogus
trailing slash on source.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-symlinkat: enhance test
Eric Blake [Mon, 21 Sep 2009 20:07:44 +0000 (14:07 -0600)]
test-symlinkat: enhance test

* tests/test-readlink.c (main): Move guts...
* tests/test-readlink.h (test_readlink): ...into new file.
* tests/test-symlink.c (main): Move guts...
* tests/test-symlink.h (test_symlink): ...into new file.
* tests/test-symlinkat.c (main): Use new files for further
coverage.
(do_symlink, do_readlink): New helper functions.
* modules/symlink-tests (Files): Ship new file.
(Depends-on): Add stdbool.
* modules/readlink-tests (Files): Ship new file.
(Depends-on): Add stdbool.
* modules/symlinkat-tests (Files): Use new files.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoreadlink: document portability issue with symlink length
Eric Blake [Mon, 21 Sep 2009 20:40:20 +0000 (14:40 -0600)]
readlink: document portability issue with symlink length

Per comments in areadlink, ERANGE on a too-small buffer is
expected on some platforms; making the readlink module guarantee
GNU behavior of truncated contents is counter-productive, since
we would be duplicating areadlink to learn a-priori how large to
make the buffer, and since truncated contents are not as useful.

* doc/posix-functions/lstat.texi (lstat): Mention that some file
systems have bogus st_size on symlinks, and mention the
areadlink-with-size module.
* doc/posix-functions/fstatat.texi (fstatat): Likewise.
* doc/posix-functions/readlink.texi (readlink): Mention the
areadlink module, and ERANGE failure.
* doc/posix-functions/readlinkat.texi (readlinkat): Likewise.
* tests/test-readlink.c (main): Relax test for AIX, HP-UX.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoreadlink: fix Solaris 9 bug with trailing slash
Eric Blake [Tue, 22 Sep 2009 23:15:04 +0000 (17:15 -0600)]
readlink: fix Solaris 9 bug with trailing slash

readlink("link/",buf,len) mistakenly succeeded.

* lib/readlink.c (rpl_readlink): Work around trailing slash bug.
* m4/readlink.m4 (gl_FUNC_READLINK): Detect the bug.
* doc/posix-functions/readlink.texi (readlink): Document this.
* modules/readlink-tests: New test.
* tests/test-readlink.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoreadlink: fix cygwin 1.5.x bug with return type
Eric Blake [Tue, 22 Sep 2009 23:14:23 +0000 (17:14 -0600)]
readlink: fix cygwin 1.5.x bug with return type

On older systems, readlink returned int instead of ssize_t, making
the use of readlink via function pointer harder.

* m4/readlink.m4 (gl_FUNC_READLINK): Require correct signature.
* lib/unistd.in.h (readlink): Use ssize_t.
* lib/readlink.c (readlink): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (readlink): Declare replacement.
* doc/posix-functions/readlink.texi (readlink): Document this.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosymlink: use throughout gnulib
Eric Blake [Sun, 20 Sep 2009 03:58:11 +0000 (21:58 -0600)]
symlink: use throughout gnulib

* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Omit symlink check.
* lib/symlinkat.c (symlinkat) [!HAVE_SYMLINK]: Document why
symlink is not used.
* modules/symlinkat (Depends-on): Add symlink.
* modules/canonicalize-lgpl-tests (Depends-on): Likewise.
* modules/canonicalize-tests (Depends-on): Likewise.
* modules/lstat-tests (Depends-on): Likewise.
* modules/openat-tests (Depends-on): Likewise.
* modules/remove-tests (Depends-on): Likewise.
* modules/rmdir-tests (Depends-on): Likewise.
* modules/unlink-tests (Depends-on): Likewise.
* tests/test-canonicalize-lgpl.c (symlink): Delete stub.
* tests/test-canonicalize.c (symlink): Likewise.
* tests/test-fstatat.c (symlink): Likewise.
* tests/test-lstat.c (symlink): Likewise.
* tests/test-remove.c (symlink): Likewise.
* tests/test-rmdir.c (symlink): Likewise.
* tests/test-unlink.c (symlink): Likewise.
* tests/test-unlinkat.c (symlink): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosymlink: new module, for Solaris 9 bug
Eric Blake [Sun, 20 Sep 2009 03:20:42 +0000 (21:20 -0600)]
symlink: new module, for Solaris 9 bug

symlink("a","link/") mistakenly succeeds.

* modules/symlink: New file.
* m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise.
* lib/symlink.c: Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add defaults.
* modules/unistd (Makefile.am): Substitute them.
* lib/unistd.in.h (symlink): Declare replacement.
* MODULES.html.sh (File system functions): Mention it.
* doc/posix-functions/symlink.texi (symlink): Likewise.
* modules/symlink-tests: New test.
* tests/test-symlink.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoAdd 'link-warning' to testsrelated_modules during --import.
Bruno Haible [Wed, 23 Sep 2009 08:28:57 +0000 (10:28 +0200)]
Add 'link-warning' to testsrelated_modules during --import.

14 years agoFix value of uses_subdirs in tests/Makefile.am.
Bruno Haible [Wed, 23 Sep 2009 08:13:41 +0000 (10:13 +0200)]
Fix value of uses_subdirs in tests/Makefile.am.

14 years agounistd: sort replacement declarations
Eric Blake [Sun, 20 Sep 2009 02:37:50 +0000 (20:37 -0600)]
unistd: sort replacement declarations

* lib/unistd.in.h: Sort declarations.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopen, openat: minor optimization
Eric Blake [Mon, 21 Sep 2009 23:19:10 +0000 (17:19 -0600)]
open, openat: minor optimization

* lib/open.c (open): If open succeeded, len is non-zero.
* lib/openat.c (rpl_openat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolink-follow: ensure correct result
Eric Blake [Tue, 22 Sep 2009 12:24:25 +0000 (06:24 -0600)]
link-follow: ensure correct result

* m4/fcntl_h.m4 (gl_FCNTL_H): Clean up temporary file.
* m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Likewise, and
distinguish between possible failures.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofts: avoid compiler warning
Eric Blake [Mon, 21 Sep 2009 16:11:18 +0000 (10:11 -0600)]
fts: avoid compiler warning

* lib/fts.c (dirent_inode_sort_may_be_useful)
(leaf_optimization_applies) [!__linux__]: Mark unused parameters.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoDeclare canonicalize_file_name.
Bruno Haible [Sun, 20 Sep 2009 03:58:45 +0000 (05:58 +0200)]
Declare canonicalize_file_name.

14 years agolink: fix quoting
Eric Blake [Sun, 20 Sep 2009 02:17:33 +0000 (20:17 -0600)]
link: fix quoting

* m4/link.m4 (gl_FUNC_LINK): Fix shell quoting.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: fix openat bugs on Solaris 9
Eric Blake [Sat, 19 Sep 2009 17:16:58 +0000 (11:16 -0600)]
openat: fix openat bugs on Solaris 9

openat(fd,"file/",O_RDONLY) mistakenly succeeded.

* lib/openat.c (rpl_openat): Work around Solaris 9 bug.
* m4/openat.m4 (gl_FUNC_OPENAT): Also replace openat on Solaris.
* modules/openat (Depends-on): Add open.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide new default.
* modules/fcntl-h (Makefile.am): Substitute it.
* lib/fcntl.in.h (openat): Declare replacement.
* doc/posix-functions/openat.texi (openat): Document this.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: move fstatat and unlinkat into correct files
Eric Blake [Sat, 19 Sep 2009 11:50:30 +0000 (05:50 -0600)]
openat: move fstatat and unlinkat into correct files

Code motion, should be no semantic changes.

* m4/openat.m4 (gl_FUNC_OPENAT): Adjust which files will be
compiled.
* lib/openat.c (fstatat, unlinkat): Move...
* lib/fstatat.c (fstatat): ...into correct files.
* lib/unlinkat.c (unlinkat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: fix unlinkat bugs on Solaris 9
Eric Blake [Sat, 19 Sep 2009 01:39:06 +0000 (19:39 -0600)]
openat: fix unlinkat bugs on Solaris 9

unlinkat(fd,"file/",0) mistakenly succeeded.

* lib/unlinkat.c (unlinkat): New file.
* modules/openat (Depends-on): Add unlink.
(Files): Distribute it.
* m4/openat.m4 (gl_FUNC_OPENAT): Mark unlinkat for replacement if
trailing slash behavior is broken.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (unlinkat): Declare replacement.
* doc/posix-functions/unlinkat.texi (unlinkat): Document this.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: fix fstatat bugs on Solaris 9
Eric Blake [Sat, 19 Sep 2009 01:38:46 +0000 (19:38 -0600)]
openat: fix fstatat bugs on Solaris 9

fstatat(fd,"file/",buf,flag) mistakenly succeeded.

* lib/fstatat.c (rpl_fstatat): Copy recent fixes from lstat and
stat.
* doc/posix-functions/fstatat.texi (fstatat): Document this.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-unlinkat: enhance test, to expose Solaris 9 bug
Eric Blake [Fri, 18 Sep 2009 04:16:56 +0000 (22:16 -0600)]
test-unlinkat: enhance test, to expose Solaris 9 bug

Share the unlink tests with unlinkat.

* tests/test-unlink.c (main): Factor guts...
* tests/test-unlink.h (test_rmdir_func): ...into new file.
* tests/test-rmdir.h (test_rmdir_func): Add parameter.
* tests/test-rmdir.c (main): Adjust caller.
* tests/test-unlinkat.c (main): Likewise.  Add unlink tests.
(unlinker): New helper function.
(rmdirat): Enhance check.
* modules/rmdir-tests (Depends-on): Add stdbool.
* modules/unlink-tests (Depends-on): Likewise.
(Files): Add test-unlink.h.
* modules/openat-tests (Files): Likewise.
(Depends-on): Add unlinkdir.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-fstatat: new test, to expose Solaris 9 bugs
Eric Blake [Sat, 19 Sep 2009 00:06:31 +0000 (18:06 -0600)]
test-fstatat: new test, to expose Solaris 9 bugs

Share the stat and lstat tests with fstatat.

* tests/test-stat.c (main): Factor guts...
* tests/test-stat.h (test_stat_func): ...into new file.
* tests/test-lstat.c (main): Factor guts...
* tests/test-lstat.h (test_lstat_func): ...into new file.
* tests/test-fstatat.c: New file.
* modules/stat-tests (Files): Add test-stat.h.
* modules/lstat-tests (Files): Add test-lstat.h.
(Depends-on): Add stdbool.
* modules/openat-tests (Depends-on): Add pathmax.
(Files): Add test-lstat.h, test-stat.h, test-fstatat.c.
(Makefile.am): Run new test.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoremove: new module, for mingw and Solaris 9 bugs
Eric Blake [Mon, 14 Sep 2009 22:57:55 +0000 (16:57 -0600)]
remove: new module, for mingw and Solaris 9 bugs

Mingw obeys C89, but not POSIX, by not handling directories.
Solaris remove("file/") mistakenly succeeded.

* modules/remove: New file.
* lib/remove.c: Likewise.
* m4/remove.m4 (gl_FUNC_REMOVE): Likewise.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Add witnesses.
* modules/stdio (Makefile.am): Use them.
* lib/stdio.in.h (remove): Declare replacement.
* MODULES.html.sh (systems lacking POSIX:2008): Mention module.
* doc/posix-functions/remove.texi (remove): Likewise.
* modules/remove-tests: New test.
* tests/test-remove.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agounlink: new module, for Solaris 9 bug
Eric Blake [Wed, 16 Sep 2009 23:13:20 +0000 (17:13 -0600)]
unlink: new module, for Solaris 9 bug

unlink("file/") mistakenly succeeded.  This patch favors, but
does not enforce, GNU semantics that unlink("link-to-dir/")
flat-out fails rather than attempting to unlink "dir".

* modules/unlink: New file.
* lib/unlink.c: Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witnesses.
* modules/unistd (Makefile.am): Use them.
* lib/unistd.in.h (stat): Declare replacement.
* MODULES.html.sh (systems lacking POSIX:2008): Mention module.
* doc/posix-functions/unlink.texi (unlink): Likewise.
* modules/unlink-tests: New test.
* tests/test-unlink.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolstat: fix Solaris 9 bug
Eric Blake [Thu, 17 Sep 2009 21:55:24 +0000 (15:55 -0600)]
lstat: fix Solaris 9 bug

lstat("file/",buf) mistakenly succeeded.

* lib/lstat.c (lstat): Also check for trailing slash on
non-symlink, non-directories.  Use stat module to simplify logic.
* doc/posix-functions/lstat.texi (lstat): Document it.
* modules/lstat-tests (Depends-on): Add errno, same-inode.
(configure.ac): Check for symlink.
* tests/test-lstat.c (main): Add more tests.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostat: add as dependency to other modules
Eric Blake [Tue, 15 Sep 2009 20:43:14 +0000 (14:43 -0600)]
stat: add as dependency to other modules

Modules that use stat but are not in this list don't trip any of
the bugs that the stat module fixes.

* modules/chown (Depends-on): Add stat.
* modules/euidaccess (Depends-on): Likewise.
* modules/fchdir (Depends-on): Likewise.
* modules/isdir (Depends-on): Likewise.
* modules/link (Depends-on): Likewise.
* modules/lstat (Depends-on): Likewise.
* modules/mkdir-p (Depends-on): Likewise.
* modules/modechange (Depends-on): Likewise.
* modules/open (Depends-on): Likewise.
* modules/readlink (Depends-on): Likewise.
* modules/same (Depends-on): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostat: fix Solaris 9 bug
Eric Blake [Tue, 15 Sep 2009 23:08:39 +0000 (17:08 -0600)]
stat: fix Solaris 9 bug

stat("file/",buf) mistakenly succeeded.

* m4/stat.m4 (gl_FUNC_STAT): Detect Solaris 9 bug with trailing
slash.
* lib/stat.c (rpl_stat): Work around it.
* doc/posix-functions/stat.texi (stat): Update documentation.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostat: new module, for mingw bug
Eric Blake [Tue, 15 Sep 2009 13:11:40 +0000 (07:11 -0600)]
stat: new module, for mingw bug

Depending on the current directory, either stat(".",buf) or
stat("./",buf) would fail on mingw.

* modules/stat: New file.
* lib/stat.c: Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add witnesses.
* modules/sys_stat (Makefile.am): Use them.
* lib/sys_stat.in.h (stat): Declare replacement.
* lib/openat.c (fstatat): Deal with lstat and stat being function
macros.
* modules/openat (Depends-on): Add inline.
* MODULES.html.sh (systems lacking POSIX:2008): Mention module.
* doc/posix-functions/stat.texi (stat): Likewise.
* modules/stat-tests: New test.
* tests/test-stat.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosyntax-check: detect unnecessary inclusion of canonicalize.h
Jim Meyering [Sat, 19 Sep 2009 17:51:05 +0000 (19:51 +0200)]
syntax-check: detect unnecessary inclusion of canonicalize.h

* top/maint.mk (sc_prohibit_canonicalize_without_use): New rule.

14 years agocanonicalize-lgpl: adjust clients to use correct header
Eric Blake [Sat, 19 Sep 2009 17:21:19 +0000 (11:21 -0600)]
canonicalize-lgpl: adjust clients to use correct header

* m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE)
(gl_CANONICALIZE_LGPL): Use correct shell quoting.
* modules/relocatable-prog-wrapper (Files): Drop canonicalize.h.
* lib/fchdir.c (includes): Use <stdlib.h>, not "canonicalize.h".
* lib/progreloc.c (includes): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-posixtm.c: correct a comment
Jim Meyering [Sat, 19 Sep 2009 16:55:20 +0000 (18:55 +0200)]
test-posixtm.c: correct a comment

* tests/test-posixtm.c: Correct first-line comment.
Spotted by Eric Blake.

14 years agoposixtm-tests: revamp
Jim Meyering [Thu, 17 Sep 2009 12:15:38 +0000 (14:15 +0200)]
posixtm-tests: revamp

Record only the expected time_t value, not the ctime string.
Skip any test that would require a time_t value larger than
currently representable (e.g., if run with 32-bit time_t,
this skips any test that expects an out-of-range value).
* tests/test-posixtm.c (struct posixtm_test) [valid, t_expected]:
New members.
[expected]: Remove member.
(T): Include new column: valid.  Move date strings into comments.
(main): Adapt.
Print a diagnostic for each skipped test.
Don't skip the entire test (exit 77) if time_t is unsigned.
Instead, skip only the individual tests with a negative result.

14 years agoposixtm-tests: make T const-correct; add a test case
Jim Meyering [Wed, 16 Sep 2009 18:20:17 +0000 (20:20 +0200)]
posixtm-tests: make T const-correct; add a test case

* tests/test-posixtm.c (T): Declare const.
Add a test for -(2^31+1).
Remove useless can-succeed-only-in-2002 test.

14 years agoposixtm-tests: correct the sole failing test
Jim Meyering [Wed, 16 Sep 2009 08:36:36 +0000 (10:36 +0200)]
posixtm-tests: correct the sole failing test

* tests/test-posixtm.c: Correct 0000-01-01 00:00:00 test so that
expected output matches what mktime now produces.  Cross-checked via
erlang's calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}})

14 years agoposixtm: move #ifdef'd tests into a new module
Jim Meyering [Wed, 16 Sep 2009 06:36:40 +0000 (08:36 +0200)]
posixtm: move #ifdef'd tests into a new module

* lib/posixtm.c (posixtime): Remove #ifdef'd tests.  Move to...
* tests/test-posixtm.c: ... this new file.
* modules/posixtm-tests: New module.

14 years agoopenat: simplify use of at-func.c
Eric Blake [Sat, 19 Sep 2009 14:03:45 +0000 (08:03 -0600)]
openat: simplify use of at-func.c

* lib/at-func.c (includes): Include prerequisites here, to
simplify requirements on client files.
* lib/openat-priv.h: Add double-inclusion guard.
* lib/faccessat.c (includes): Simplify.
* lib/fchmodat.c (includes): Likewise.
* lib/fchownat.c (includes): Likewise.
* lib/mkdirat.c (includes): Likewise.
* lib/mkfifoat.c (includes): Likewise.
* lib/symlinkat.c (includes): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: allow return of fd 0
Eric Blake [Sat, 19 Sep 2009 13:12:15 +0000 (07:12 -0600)]
openat: allow return of fd 0

Partially reverts patch fc33350 from 2009-09-02.

* modules/chdir-long (Depends-on): Relax openat-safer to openat.
* modules/save-cwd (Depends-on): Replace fcntl-safer with
unistd-safer.
* lib/chdir-long.c (includes): Replace "fcntl--.h" with
<fcntl.h>; this module does not leak fds.
* lib/openat.c (includes): Do not use "fcntl_safer"; plain openat
must be allowed to return 0, leaving openat_safer to add the
safety.
(openat_permissive): Avoid writing to just-opened fd 2 if
restoring the current directory fails.
* lib/openat-die.c (openat_restore_fail): Add comment.
* lib/save-cwd.c (includes): Make "fcntl--.h" conditional.
(save_cwd): Guarantee safe fd, but without use of open_safer.
* tests/test-openat.c: New test.
* modules/openat-tests (Files, Makefile.am): Distribute and build
new file.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoautoupdate
Karl Berry [Sat, 19 Sep 2009 13:56:46 +0000 (06:56 -0700)]
autoupdate

14 years agorelocatable-prog-wrapper: fix build
Eric Blake [Sat, 19 Sep 2009 11:19:32 +0000 (05:19 -0600)]
relocatable-prog-wrapper: fix build

* modules/relocatable-prog-wrapper (Files): Update name of
canonicalize m4 file, broken on 2009-09-17.
Reported by emad hajjar <aleppos@hotmail.com>.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoUse the standard header with GPL copyright.
Bruno Haible [Sat, 19 Sep 2009 08:47:54 +0000 (10:47 +0200)]
Use the standard header with GPL copyright.

14 years agoUse the standard header with LGPL copyright.
Bruno Haible [Sat, 19 Sep 2009 08:45:46 +0000 (10:45 +0200)]
Use the standard header with LGPL copyright.

14 years agoautoupdate
Karl Berry [Fri, 18 Sep 2009 13:27:23 +0000 (06:27 -0700)]
autoupdate

14 years agoAdd advice to an error message.
Bruno Haible [Fri, 18 Sep 2009 06:59:54 +0000 (08:59 +0200)]
Add advice to an error message.

14 years agocanonicalize: in CAN_ALL_BUT_LAST, allow trailing slash
Eric Blake [Sat, 12 Sep 2009 12:04:46 +0000 (06:04 -0600)]
canonicalize: in CAN_ALL_BUT_LAST, allow trailing slash

Coreutils' `readlink -f foo/' should not fail if lstat("foo")
gives ENOENT.

* lib/canonicalize.c (canonicalize_filename_mode): Skip trailing
slashes when checking if last component is missing.
* tests/test-canonicalize.c (main): Test this.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize, canonicalize-lgpl: honor // if distinct from /
Eric Blake [Thu, 10 Sep 2009 23:21:09 +0000 (17:21 -0600)]
canonicalize, canonicalize-lgpl: honor // if distinct from /

* modules/canonicalize (Files): Add double-slash-root.m4.
* modules/canonicalize-lgpl (Files): Likewise.
* m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE)
(gl_CANONICALIZE_LGPL_SEPARATE): Add dependency.
* lib/canonicalize.c (DOUBLE_SLASH_IS_DISTINCT_ROOT): Provide
fallback definition.
(canonicalize_filename_mode): Use it to protect //.
* lib/canonicalize-lgpl.c (DOUBLE_SLASH_IS_DISTINCT_ROOT)
(__realpath): Likewise.
* tests/test-canonicalize.c (main): Test this.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* modules/canonicalize-tests (Depends-on): Add same-inode.
* modules/canonicalize-lgpl-tests (Depends-on): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize-lgpl: fix glibc bug with trailing slash
Eric Blake [Fri, 11 Sep 2009 19:57:55 +0000 (13:57 -0600)]
canonicalize-lgpl: fix glibc bug with trailing slash

Consolidate the m4 macros into a single file, since both modules
now have to worry about replacing canonicalize_file_name on
buggy glibc.

* m4/canonicalize-lgpl.m4: Move contents...
* m4/canonicalize.m4: ...here.
(gl_CANONICALIZE_LGPL): Factor realpath check...
(gl_FUNC_REALPATH_WORKS): ...into new macro.  Enhance to catch
glibc 2.3.5 bug, fixed 2005-04-27.
(gl_FUNC_CANONICALIZE_FILENAME_MODE): Use it.
(gl_PREREQ_CANONICALIZE_LGPL): Inline...
(gl_CANONICALIZE_LGPL_SEPARATE): ...into this macro.
* modules/canonicalize-lgpl (Files): Manage file rename.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide default.
* modules/stdlib (Makefile.am): Substitute witness.
* lib/stdlib.in.h (canonicalize_file_name): Declare if replacement
is needed.
* lib/canonicalize-lgpl.c: Also compile if canonicalize_file_name
replacement is required.
* lib/canonicalize.c (canonicalize_file_name): Likewise.
* doc/glibc-functions/canonicalize_file_name.texi
(canonicalize_file_name): Document this.
* doc/posix-functions/realpath.texi (realpath): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize-lgpl: reject non-directory with trailing slash
Eric Blake [Fri, 11 Sep 2009 19:31:06 +0000 (13:31 -0600)]
canonicalize-lgpl: reject non-directory with trailing slash

This synchronizes glibc to gnulib.  For gnulib to glibc, see:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=10635

* lib/canonicalize-lgpl.c (__realpath): Synchronize with glibc.
* tests/test-canonicalize-lgpl.c (main): Enhance test.  This
catches failures in glibc 2.3.5.
* tests/test-canonicalize.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize-lgpl: use native realpath if it works
Eric Blake [Thu, 10 Sep 2009 21:44:15 +0000 (15:44 -0600)]
canonicalize-lgpl: use native realpath if it works

Forward-looking to when more platforms comply with POSIX 2008,
but don't provide glibc extensions.  For example, this could
fix // handling in cygwin 1.7 (well, if cygwin didn't have bugs
in .. handling).  canonicalize can't use native realpath, for
the same reason that it does not use resolvepath.

* lib/canonicalize-lgpl.c (realpath): Guard with
FUNC_REALPATH_WORKS.
* lib/stdlib.in.h (realpath): Make declaration optional based on
HAVE_REALPATH.
* m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL): Check whether
native realpath works.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide default.
* modules/stdlib (Makefile.am): Substitute witness.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize, canonicalize-lgpl: use <stdlib.h>
Eric Blake [Fri, 11 Sep 2009 18:18:10 +0000 (12:18 -0600)]
canonicalize, canonicalize-lgpl: use <stdlib.h>

Match current gnulib conventions of glibc functions being declared in
the same header as glibc.  This makes it easier to replace broken
canonicalize_file_name.  canonicalize still requires "canonicalize.h"
because canonicalize_filename_mode is not in glibc.  With this patch,
canonicalize-lgpl always provides realpath and canonicalize_file_name,
while canonicalize can provide canonicalize_file_name but not
realpath; if both modules are in use, canonicalize_file_name comes
from the LGPLv2+ sources, but the testing comes from canonicalize.

* modules/canonicalize-lgpl (Files): Drop canonicalize.h.
(Include): Mention <stdlib.h>.
(configure.ac): Mention functions we provide.
* modules/canonicalize (configure.ac): Likewise.
* m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL): Always replace
realpath if canonicalize_file_name is missing.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Provide defaults.
* modules/stdlib (Makefile.am): Substitute witnesses.
* lib/stdlib.in.h (canonicalize_file_name, realpath): Declare.
* lib/canonicalize-lgpl.c (includes): Adjust accordingly.
* lib/canonicalize.h (canonicalize_file_name): Drop declaration.
* NEWS: Document this.
* doc/glibc-functions/canonicalize_file_name.texi
(canonicalize_file_name): Likewise.
* doc/posix-functions/realpath.texi (realpath): Likewise.
* tests/test-canonicalize-lgpl.c (includes): Use <stdlib.h>.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-canonicalize: consolidate into single C program
Eric Blake [Fri, 11 Sep 2009 15:53:44 +0000 (09:53 -0600)]
test-canonicalize: consolidate into single C program

* tests/test-canonicalize.sh: Delete; move setup into...
* tests/test-canonicalize.c (main): ...the program, making it
easier to run in debugger.  Add some tests.
* modules/canonicalize-tests (Files): Remove unused file.
(Depends-on): Add progname.
(configure.ac, Makefile.am): Simplify.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-canonicalize-lgpl: consolidate into single C program
Eric Blake [Fri, 11 Sep 2009 14:59:54 +0000 (08:59 -0600)]
test-canonicalize-lgpl: consolidate into single C program

Testing canonicalize bugs is easier if the setup can be run under
control of the debugger, rather than in a driver script.  As a
bonus side effect, parallel testing with test-canonicalize no
longer competes for the file name "./ise".

* tests/test-canonicalize-lgpl.sh: Delete; move setup into...
* tests/test-canonicalize-lgpl.c (main): ...the program, making it
easier to run in debugger.  Add some tests.
* modules/canonicalize-lgpl-tests (Files): Remove unused file.
(configure.ac, Makefile.am): Simplify.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize: avoid resolvepath
Eric Blake [Fri, 11 Sep 2009 20:57:01 +0000 (14:57 -0600)]
canonicalize: avoid resolvepath

Back when canonicalize merely provided canonicalize_file_name,
resolvepath was more efficient than implementing a complete
realpath.  But since resolvepath can't implement other modes for
canonicalize_filename_mode, using it is now just bulk on Solaris.

* m4/canonicalize.m4 (gl_FUNC_CANONICALIZE_FILENAME_MODE): Delete
unnecessary checks.
* lib/canonicalize.c (includes): Simplify.
(canonicalize_file_name): Drop resolvepath implementation.
* modules/canonicalize (Depends-on): Drop filenamecat.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize: don't lose errno
Eric Blake [Wed, 16 Sep 2009 19:51:50 +0000 (13:51 -0600)]
canonicalize: don't lose errno

canonicalize-lgpl was already immune; glibc has the same bug:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=10635

* lib/canonicalize.c (canonicalize_filename_mode): Protect errno
over calls to free.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize: simplify errno handling
Eric Blake [Wed, 16 Sep 2009 19:49:10 +0000 (13:49 -0600)]
canonicalize: simplify errno handling

This file originally forked from glibc, but has had so many other
changes that it does not need to maintain glibc macros.

* lib/canonicalize.c (__set_errno): Delete macro, and use direct
assignment.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agocanonicalize, canonicalize-lgpl: update module dependencies
Eric Blake [Fri, 11 Sep 2009 14:34:37 +0000 (08:34 -0600)]
canonicalize, canonicalize-lgpl: update module dependencies

The m4 files were checking whether canonicalize_file_name was
declared, but without enabling extensions, this would never
succeed.  Also, mingw failed to compile the module combination of
canonicalize-lgpl and sys_stat, due to a link error on lstat.

* modules/canonicalize (Depends-on): Add extensions, lstat,
pathmax, stdlib.
(Files): Drop pathmax.h.
(configure.ac): Adjust macro name.
* modules/canonicalize-lgpl (Depends-on): Add errno, extensions,
lstat, stdlib, sys_stat.
* m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME): Rename...
(gl_FUNC_CANONICALIZE_FILENAME_MODE): ...to this, and require
extensions.
* m4/canonicalize-lgpl.m4 (gl_CANONICALIZE_LGPL)
(gl_CANONICALIZE_LGPL_SEPARATE): Require extensions.
(gl_PREREQ_CANONICALIZE_LGPL): Assume unistd.h.
* lib/canonicalize.h (canonicalize_file_name): Use <stdlib.h>
declaration, if available.
* lib/canonicalize-lgpl.c [HAVE_READLINK]: Delete this condition;
we can rely on the readlink module.
(MAXSYMLINKS): Also consult SYMLOOP_MAX.
(includes): Use <unistd.h> unconditionally.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint: make Include sections of modules consistent
Eric Blake [Thu, 17 Sep 2009 17:49:36 +0000 (11:49 -0600)]
maint: make Include sections of modules consistent

Done with "sed -i 's/^#include //' `git grep -l ^#include modules`".

* modules/alloca: Use only header name; no need to list #include.
* modules/alloca-opt: Likewise.
* modules/arpa_inet: Likewise.
* modules/canon-host: Likewise.
* modules/configmake: Likewise.
* modules/dirent: Likewise.
* modules/eealloc: Likewise.
* modules/environ: Likewise.
* modules/fchdir: Likewise.
* modules/fcntl: Likewise.
* modules/fcntl-h: Likewise.
* modules/gethrxtime: Likewise.
* modules/gettime: Likewise.
* modules/ignore-value: Likewise.
* modules/inet_ntop: Likewise.
* modules/inet_pton: Likewise.
* modules/inttypes: Likewise.
* modules/isnand-nolibm: Likewise.
* modules/isnanf-nolibm: Likewise.
* modules/mbchar: Likewise.
* modules/mbfile: Likewise.
* modules/mbiter: Likewise.
* modules/mbuiter: Likewise.
* modules/netdb: Likewise.
* modules/netinet_in: Likewise.
* modules/nproc: Likewise.
* modules/pagealign_alloc: Likewise.
* modules/poll: Likewise.
* modules/printf-frexp: Likewise.
* modules/pthread: Likewise.
* modules/putenv: Likewise.
* modules/random_r: Likewise.
* modules/relocatable-prog: Likewise.
* modules/search: Likewise.
* modules/select: Likewise.
* modules/selinux-h: Likewise.
* modules/settime: Likewise.
* modules/signal: Likewise.
* modules/size_max: Likewise.
* modules/socklen: Likewise.
* modules/ssize_t: Likewise.
* modules/stdarg: Likewise.
* modules/stdbool: Likewise.
* modules/stddef: Likewise.
* modules/stdint: Likewise.
* modules/stdio: Likewise.
* modules/stdlib: Likewise.
* modules/string: Likewise.
* modules/strings: Likewise.
* modules/sys_file: Likewise.
* modules/sys_ioctl: Likewise.
* modules/sys_select: Likewise.
* modules/sys_socket: Likewise.
* modules/sys_stat: Likewise.
* modules/sys_time: Likewise.
* modules/sys_times: Likewise.
* modules/sys_utsname: Likewise.
* modules/sys_wait: Likewise.
* modules/sysexits: Likewise.
* modules/time: Likewise.
* modules/times: Likewise.
* modules/tmpfile: Likewise.
* modules/trim: Likewise.
* modules/unistd: Likewise.
* modules/wchar: Likewise.
* modules/wctype: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoChangeLog: tweak wording of prior commit
Eric Blake [Thu, 17 Sep 2009 22:50:56 +0000 (16:50 -0600)]
ChangeLog: tweak wording of prior commit

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoMake getdate.y compile on QNX and NetBSD 5 / i386.
Bruno Haible [Thu, 17 Sep 2009 20:42:33 +0000 (22:42 +0200)]
Make getdate.y compile on QNX and NetBSD 5 / i386.

14 years agoTweak copyright statements.
Bruno Haible [Thu, 17 Sep 2009 20:07:35 +0000 (22:07 +0200)]
Tweak copyright statements.

14 years agoUpdate references for gnuit package.
Ian Beckwith [Thu, 17 Sep 2009 19:59:08 +0000 (21:59 +0200)]
Update references for gnuit package.

14 years agoFix typo in copyright line.
Ian Beckwith [Thu, 17 Sep 2009 19:58:04 +0000 (21:58 +0200)]
Fix typo in copyright line.

14 years agoUse the standard header with GPL copyright.
Bruno Haible [Thu, 17 Sep 2009 19:45:28 +0000 (21:45 +0200)]
Use the standard header with GPL copyright.

14 years agousers.txt: add augeas and netcf
David Lutterkort [Thu, 17 Sep 2009 18:17:59 +0000 (11:17 -0700)]
users.txt: add augeas and netcf

14 years agormdir: ensure correct dependency order
Eric Blake [Thu, 17 Sep 2009 12:55:43 +0000 (06:55 -0600)]
rmdir: ensure correct dependency order

* m4/rmdir.m4 (gl_FUNC_RMDIR): Require unistd defaults.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoDisable assertion that fails on NetBSD 5 / i386.
Bruno Haible [Thu, 17 Sep 2009 06:07:50 +0000 (08:07 +0200)]
Disable assertion that fails on NetBSD 5 / i386.

14 years agounlinkdir: port to mingw
Eric Blake [Wed, 16 Sep 2009 23:18:28 +0000 (17:18 -0600)]
unlinkdir: port to mingw

* m4/unlinkdir.m4 (gl_UNLINKDIR): Add mingw to list of platforms
that refuse anyone to unlink a directory.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostdlib: sort witness names
Eric Blake [Thu, 10 Sep 2009 20:10:41 +0000 (14:10 -0600)]
stdlib: sort witness names

* modules/stdlib (Makefile.am): Sort replacements.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Likewise.
* lib/stdlib.in.h: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoparse-duration-tests: avoid link failure
Eric Blake [Wed, 16 Sep 2009 17:49:31 +0000 (11:49 -0600)]
parse-duration-tests: avoid link failure

* modules/parse-duration-tests (test_parse_duration_LDADD): Add
LIBINTL.
Reported by Tom G. Christensen.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat-tests: ensure unlinkat behaves like rmdir
Eric Blake [Wed, 16 Sep 2009 19:21:46 +0000 (13:21 -0600)]
openat-tests: ensure unlinkat behaves like rmdir

* tests/test-rmdir.c (main): Factor guts...
* tests/test-rmdir.h (test_rmdir_func): ...into new file.
* modules/rmdir-tests (Files): Ship new file.
* modules/openat-tests: New test.
* tests/test-unlinkat.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agormdir-errno: mark obsolete, it is unsafe for cross-compilation
Eric Blake [Wed, 16 Sep 2009 19:31:05 +0000 (13:31 -0600)]
rmdir-errno: mark obsolete, it is unsafe for cross-compilation

* modules/rmdir-errno (Status, Notice): Now obsolete.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agormdir: work around cygwin 1.5.x and mingw bugs
Eric Blake [Wed, 16 Sep 2009 16:08:55 +0000 (10:08 -0600)]
rmdir: work around cygwin 1.5.x and mingw bugs

* m4/rmdir.m4 (gl_FUNC_RMDIR): Detect the bugs.
* lib/rmdir.c (rmdir): Work around it.
* modules/rmdir (Status, Notice): No longer obsolete.
(Files): Add dos.m4.
(Depends-on): Add unistd.
(configure.ac): Set witnesses.
(License): Relax to LGPLv2+.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set defaults.
* modules/unistd (Makefile.am): Substitute witnesses.
* lib/unistd.in.h (rmdir): Declare replacement.
* doc/posix-functions/rmdir.texi (rmdir): Document this.
* modules/rmdir-tests: New tests.
* tests/test-rmdir.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofchdir: improve use of replacement functions
Eric Blake [Tue, 15 Sep 2009 21:54:43 +0000 (15:54 -0600)]
fchdir: improve use of replacement functions

* m4/fchdir.m4 (gl_FUNC_FCHDIR): Set appropriate witnesses.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add REPLACE_FSTAT.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): Add REPLACE_OPENDIR,
REPLACE_CLOSEDIR.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add REPLACE_DUP.
* modules/sys_stat (Makefile.am): Substitute correct witness.
* modules/dirent (Makefile.am): Likewise.
* modules/unistd (Makefile.am): Likewise.
* lib/dirent.in.h (opendir, closedir): Use better witnesses.
* lib/unistd.in.h (dup): Likewise.
* lib/sys_stat.in.h (fstat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint: ignore gnulib-tool temp files
Eric Blake [Tue, 15 Sep 2009 21:56:39 +0000 (15:56 -0600)]
maint: ignore gnulib-tool temp files

* .gitignore: Ignore files created during gnulib-tool --test.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years ago-mautoupdate
Karl Berry [Tue, 15 Sep 2009 14:06:46 +0000 (07:06 -0700)]
-mautoupdate

14 years agoposixtm: don't reject a time with "60" as the number of seconds
Jim Meyering [Sat, 12 Sep 2009 22:35:49 +0000 (00:35 +0200)]
posixtm: don't reject a time with "60" as the number of seconds

* lib/posixtm.c (posixtime): The code to reject invalid dates would
also reject a time specified with the .60 suffix, whereas POSIX allows
that, in order to accommodate leap seconds.  Don't reject that.
(main): Adjust tests accordingly.
* modules/posixtm (Depends-on): Add stpcpy.

14 years agoannounce-gen: include [$release_type] in emitted Subject:
Jim Meyering [Fri, 11 Sep 2009 10:23:14 +0000 (12:23 +0200)]
announce-gen: include [$release_type] in emitted Subject:

* build-aux/announce-gen (get_tool_versions): Include [$release_type],
e.g., [stable] in the emitted Subject: line.

14 years agoRemove obsolete macros from several modules.
Ralf Wildenhues [Thu, 10 Sep 2009 18:54:34 +0000 (20:54 +0200)]
Remove obsolete macros from several modules.

* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Replace
obsolete Autoconf macros with their modern counterparts.
* m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): Likewise.
* m4/gc-camellia.m4 (gl_GC_CAMELLIA): Likewise.
* m4/getaddrinfo.m4 (gl_GETADDRINFO): Likewise.
* m4/getdate.m4 (gl_C_COMPOUND_LITERALS): Likewise.
* m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): Likewise.
* m4/getline.m4 (gl_FUNC_GETLINE): Likewise.
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Likewise.
* m4/isfinite.m4 (gl_ISFINITEL_WORKS): Likewise.
* m4/poll.m4 (gl_FUNC_POLL): Likewise.
* m4/readline.m4 (gl_FUNC_READLINE): Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
* m4/select.m4 (gl_FUNC_SELECT): Likewise.
* m4/sockets.m4 (gl_SOCKETS): Likewise.
* m4/socklen.m4 (gl_TYPE_SOCKLEN_T): Likewise.
* m4/sockpfaf.m4 (gl_SOCKET_FAMILIES): Likewise.
* m4/sysexits.m4 (gl_SYSEXITS): Likewise.
* m4/time_r.m4 (gl_TIME_R): Likewise.
* m4/tsearch.m4 (gl_FUNC_TSEARCH): Likewise.
* m4/vararrays.m4 (AC_C_VARARRAYS): Likewise.
* m4/wctype.m4 (gl_WCTYPE_H): Likewise.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14 years agoFix copyright header in build-aux scripts.
Ralf Wildenhues [Thu, 10 Sep 2009 17:57:57 +0000 (19:57 +0200)]
Fix copyright header in build-aux scripts.

* build-aux/git-version-gen: Fix copyright header to match GPLv3
recommendation.
* build-aux/ncftpput-ftp: Likewise.
* build-aux/update-copyright: Likewise.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14 years agoautoupdate
Karl Berry [Thu, 10 Sep 2009 13:11:30 +0000 (06:11 -0700)]
autoupdate

14 years agotest-link: allow Linux choice of errno
Eric Blake [Thu, 10 Sep 2009 03:46:11 +0000 (21:46 -0600)]
test-link: allow Linux choice of errno

* tests/test-link.c (main): Relax test for alternate error.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostrndup: fix improper m4 caching
Eric Blake [Thu, 10 Sep 2009 03:34:32 +0000 (21:34 -0600)]
strndup: fix improper m4 caching

* m4/strndup.m4 (gl_FUNC_STRNDUP): Rework to avoid side effects
inside AC_CACHE_CHECK.  Use REPLACE_STRNDUP, not HAVE_STRNDUP.
(gl_PREREQ_STRNDUP): Delete.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Update default.
* modules/string (Makefile.am): Substitute it.
* lib/string.in.h (strndup): Modernize prototype.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetcwd: port to mingw
Eric Blake [Thu, 10 Sep 2009 02:52:26 +0000 (20:52 -0600)]
getcwd: port to mingw

* m4/getcwd.m4 (gl_FUNC_GETCWD): Mingw directories are very
different from the POSIX assumptions made throughout the getcwd
module; fortunately, the mingw getcwd does not need replacement.
(gl_FUNC_GETCWD_NULL): Skip test on mingw.
* modules/getcwd-tests: New test.
* tests/test-getcwd.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolink: fix platform bugs
Eric Blake [Wed, 9 Sep 2009 21:25:26 +0000 (15:25 -0600)]
link: fix platform bugs

* m4/link.m4 (gl_FUNC_LINK): Detect Solaris and Cygwin bugs.
* lib/link.c (link): Work around them.  Fix related mingw bug.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add REPLACE_LINK.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (link): Declare replacement.
* doc/posix-functions/link.texi (link): Document this.
* modules/link (Depends-on): Add strdup-posix, sys_stat.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-link: consolidate into single C program, test more cases
Eric Blake [Wed, 9 Sep 2009 17:06:44 +0000 (11:06 -0600)]
test-link: consolidate into single C program, test more cases

* tests/test-link.sh: Delete.
* tests/test-link.c: Test more error conditions.  Exposes bugs on
at least Cygwin and Solaris.
* modules/link-tests (Files): Remove unused file.
(Depends-on): Add errno, sys_stat.
(Makefile.am): Simplify.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoWork around towlower, towupper bug on mingw.
Bruno Haible [Tue, 8 Sep 2009 21:27:09 +0000 (23:27 +0200)]
Work around towlower, towupper bug on mingw.

14 years agobuild: don't try to run autoheader if we don't use it
Jim Meyering [Tue, 8 Sep 2009 20:21:59 +0000 (22:21 +0200)]
build: don't try to run autoheader if we don't use it

* build-aux/bootstrap: Define AUTOHEADER=true when AC_CONFIG_HEADERS
is not used in configure.ac.

14 years agoeuidaccess: fix compilation error
Eric Blake [Tue, 8 Sep 2009 19:06:02 +0000 (13:06 -0600)]
euidaccess: fix compilation error

* lib/euidaccess.c (includes): Add <fcntl.h>, for AT_EACCESS.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorawmemchr: relax license
Eric Blake [Tue, 8 Sep 2009 12:34:54 +0000 (06:34 -0600)]
rawmemchr: relax license

* modules/rawmemchr (License): Derived from glibc, so LGPLv2+ is
okay.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomkfifoat: new module
Eric Blake [Mon, 7 Sep 2009 11:38:18 +0000 (05:38 -0600)]
mkfifoat: new module

* modules/mkfifoat: New file.
* lib/mkfifoat.c: Likewise.
* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Likewise.
* m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add witnesses.
* modules/sys_stat (Makefile.am): Use them.
* lib/sys_stat.in.h (mkfifoat, mknodat): Declare them.
* MODULES.html.sh (File system functions): Mention module.
* doc/posix-functions/mkfifoat.texi (mkfifoat): Likewise.
* doc/posix-functions/mknodat.texi (mknodat): Likewise.
* modules/mkfifoat-tests: New test.
* tests/test-mkfifoat.c: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostrchrnul: relax license
Eric Blake [Tue, 8 Sep 2009 11:59:53 +0000 (05:59 -0600)]
strchrnul: relax license

* modules/strchrnul (License): Derived from glibc, so LGPLv2+ is
okay.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofstatat: fix compilation on Solaris
Eric Blake [Tue, 8 Sep 2009 02:16:00 +0000 (20:16 -0600)]
fstatat: fix compilation on Solaris

* lib/fstatat.c (includes): Add fcntl.h.
Reported by Pádraig Brady.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename: modernize replacement upstream/20090908+c5c46dc
Eric Blake [Mon, 7 Sep 2009 17:27:05 +0000 (11:27 -0600)]
rename: modernize replacement

* modules/rename (Depends-on): Add stdio.
(configure.ac): Declare witness.
* m4/rename.m4 (gl_FUNC_RENAME): Ensure dependency order, and let
stdio take care of replacement.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Add new defaults.
* modules/stdio (Makefile.am): Substitute them.
* lib/stdio.in.h (rename): Declare replacement.
* lib/rename.c (includes): Allow cross-compilation to non-windows
machines.
* doc/posix-functions/rename.texi (rename): Improve
documentation.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agostdio: sort witness names
Eric Blake [Mon, 7 Sep 2009 16:16:42 +0000 (10:16 -0600)]
stdio: sort witness names

* modules/stdio (Makefile.am): Sort replacements.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
* lib/stdio.in.h: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetcwd: minor cleanups
Eric Blake [Mon, 7 Sep 2009 11:51:20 +0000 (05:51 -0600)]
getcwd: minor cleanups

* lib/getcwd.c (AT_FDCWD): Delete; rely on <fcntl.h> instead.
(is_ENAMETOOLONG): Delete; ENAMETOOLONG is portable.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: provide more convenience names
Eric Blake [Mon, 7 Sep 2009 11:28:13 +0000 (05:28 -0600)]
openat: provide more convenience names

* modules/faccessat (configure.ac): Add C witness.
* lib/unistd.in.h (readlinkat): Fix typo.
* lib/openat.h (statat, lstatat, accessat, euidaccessat): New
convenience wrappers.
* top/maint.mk (sc_prohibit_openat_without_use): Allow these
wrappers in syntax checks.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodoc: fix comments in recent patches
Eric Blake [Mon, 7 Sep 2009 02:21:28 +0000 (20:21 -0600)]
doc: fix comments in recent patches

* lib/faccessat.c: Mention correct function.
* lib/fchmodat.c: Likewise.
* lib/fchownat.c: Likewise.
* lib/symlinkat.c: Likewise.
* doc/posix-headers/fcntl.texi (fcntl.h): Cygwin 1.7 has AT_*
constants.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofaccessat, symlinkat: continue cleanup of previous patch
Eric Blake [Mon, 7 Sep 2009 02:53:59 +0000 (20:53 -0600)]
faccessat, symlinkat: continue cleanup of previous patch

* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Ensure dependency order.
* m4/faccessat.m4 (gl_FUNC_FACCESSAT): Likewise.
* modules/unistd (Makefile.am): Substitute GNULIB_READLINKAT.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Offer GNULIB_READLINKAT.
* modules/symlinkat (configure.ac): Set GNULIB_READLINKAT.
* lib/unistd.in.h (readlinkat): Declare if GNULIB_READLINKAT is
set.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoRemove dependency from unistd_h.m4, sys_stat_h.m4, fcntl_h.m4 to openat.m4.
Bruno Haible [Sun, 6 Sep 2009 23:33:12 +0000 (01:33 +0200)]
Remove dependency from unistd_h.m4, sys_stat_h.m4, fcntl_h.m4 to openat.m4.