gnulib.git
14 years agodoc: tweak *at function documentation
Eric Blake [Tue, 6 Oct 2009 19:57:50 +0000 (13:57 -0600)]
doc: tweak *at function documentation

* doc/posix-functions/faccessat.texi (faccessat): Mention
known issue with replacement.
* doc/posix-functions/fchdir.texi (fchdir): Likewise.
* doc/posix-functions/linkat.texi (linkat): Likewise.
* doc/posix-functions/mkfifoat.texi (mkfifoat): Likewise.
* doc/posix-functions/mknodat.texi (mknodat): Likewise.
* doc/posix-functions/readlinkat.texi (readlinkat): Likewise.
* doc/posix-functions/renameat.texi (renameat): Likewise.
* doc/posix-functions/symlinkat.texi (symlinkat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopenat: fix GNU/Hurd bug in unlinkat
Eric Blake [Tue, 6 Oct 2009 18:03:58 +0000 (12:03 -0600)]
openat: fix GNU/Hurd bug in unlinkat

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

* m4/openat.m4 (gl_FUNC_OPENAT): Replace unlinkat if unlink is
broken.
* doc/posix-functions/unlink.texi (unlink): Document this.
* doc/posix-functions/unlinkat.texi (unlinkat): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofdopendir: fix GNU/Hurd bug
Eric Blake [Tue, 6 Oct 2009 12:58:08 +0000 (06:58 -0600)]
fdopendir: fix GNU/Hurd bug

fdopendir(open("file",O_RDONLY)) mistakenly succeeded, with
subsequent readdir() failing with ENOTDIR.

* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Check for Hurd bug in
allowing non-directory fds.
* lib/fdopendir.c (rpl_fdopendir): Work around it.
* m4/dirent_h.m4 (gl_DIRENT_H_DEFAULTS): New witness.
* modules/dirent (Makefile.am): Substitute it.
* lib/dirent.in.h (fdopendir): Declare replacement.
* doc/posix-functions/fdopendir.texi (fdopendir): Document this.
* tests/test-fdopendir.c (main): Test something other than
/dev/null, since on Hurd that behaves like a directory.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-symlink: port to GNU/Hurd
Eric Blake [Tue, 6 Oct 2009 13:09:13 +0000 (07:09 -0600)]
test-symlink: port to GNU/Hurd

* tests/test-symlink.h (test_symlink): Relax expected errno.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodoc: tweak more cygwin information
Eric Blake [Tue, 6 Oct 2009 19:58:06 +0000 (13:58 -0600)]
doc: tweak more cygwin information

* doc/glibc-headers/getopt.texi (getopt.h): Cygwin 1.7 getopt is
now compatible with glibc.
* doc/posix-functions/getopt.texi (getopt): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetopt-gnu: add another test
Eric Blake [Tue, 6 Oct 2009 20:29:13 +0000 (14:29 -0600)]
getopt-gnu: add another test

Ensure that POSIXLY_CORRECT does not interfere with optional argument
behavior; older BSD implementations botched this.

* tests/test-getopt_long.h (test_getopt_long_posix): New test, to
guarantee behavior relied on by m4.
* tests/test-getopt.c (main): Use it.
* modules/getopt-posix-tests (Depends-on): Add setenv.
See http://lists.gnu.org/archive/html/bug-m4/2006-09/msg00028.html.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetopt: fix compilation on darwin
Eric Blake [Wed, 7 Oct 2009 02:44:13 +0000 (20:44 -0600)]
getopt: fix compilation on darwin

* lib/getopt.in.h (includes): Leave breadcrumbs during system
include.
* lib/unistd.in.h (getopt): Use them to avoid recursive include.
Reported by Ludovic Courtès.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoDiscourage the module 'size_max'.
Bruno Haible [Tue, 6 Oct 2009 21:48:47 +0000 (23:48 +0200)]
Discourage the module 'size_max'.

14 years agolinkat: avoid compilation failure
Jim Meyering [Tue, 6 Oct 2009 09:11:39 +0000 (11:11 +0200)]
linkat: avoid compilation failure

* lib/linkat.c: Include <stdint.h> for use of SIZE_MAX.

14 years agolinkat: support Linux 2.6.17
Eric Blake [Tue, 6 Oct 2009 03:30:33 +0000 (21:30 -0600)]
linkat: support Linux 2.6.17

* m4/linkat.m4 (gl_FUNC_LINKAT): Default to always replacing
linkat on Linux, but allow cache variable override.
* lib/linkat.c (rpl_linkat): Define override.
* modules/linkat (Depends-on): Add symlinkat.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add new default.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (linkat): Declare replacement.
Reported by Pádraig Brady.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoquotearg: port test to systems with C.UTF-8 locale
Eric Blake [Mon, 5 Oct 2009 23:17:34 +0000 (17:17 -0600)]
quotearg: port test to systems with C.UTF-8 locale

* tests/test-quotearg.c (struct result_strings): Add another
member, differentiating between C.ASCII and C.UTF-8 handling.
(compare_strings): Add parameter.
(main): Adjust all callers.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetopt: avoid clash with FreeBSD _getopt_internal
Eric Blake [Mon, 5 Oct 2009 20:34:25 +0000 (14:34 -0600)]
getopt: avoid clash with FreeBSD _getopt_internal

* lib/getopt.in.h (_getopt_internal): Override the name.
* lib/getopt_int.h (includes): Pick up any overrides.
Reported by Reuben Thomas.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agohash: allow C89 compilation
Eric Blake [Mon, 5 Oct 2009 19:52:28 +0000 (13:52 -0600)]
hash: allow C89 compilation

* lib/hash.c (check_tuning): Move declaration before statement.
Reported by Reuben Thomas.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoinclude execvpe.texi, so doc builds again
Karl Berry [Mon, 5 Oct 2009 13:36:16 +0000 (06:36 -0700)]
include execvpe.texi, so doc builds again

14 years agopush changelog for previous change
Paolo Bonzini [Sun, 4 Oct 2009 12:56:51 +0000 (14:56 +0200)]
push changelog for previous change

14 years agouname: Rewrite printing of Windows NT versions
Paolo Bonzini [Sun, 4 Oct 2009 10:24:28 +0000 (12:24 +0200)]
uname: Rewrite printing of Windows NT versions

* lib/uname.c (uname): Use a table-driver algorithm to compute
Windows NT versions.

14 years agoRemove the "lt-" prefix from program_invocation_short_name.
Bruno Haible [Sun, 4 Oct 2009 10:14:52 +0000 (12:14 +0200)]
Remove the "lt-" prefix from program_invocation_short_name.

14 years agoFix a misleading comment.
Bruno Haible [Sun, 4 Oct 2009 10:08:17 +0000 (12:08 +0200)]
Fix a misleading comment.

14 years agoDo only one call to GetVersionEx in the common case.
Bruno Haible [Sat, 3 Oct 2009 18:34:12 +0000 (20:34 +0200)]
Do only one call to GetVersionEx in the common case.

14 years agoAdd support for Windows CE and various non-x86 CPU types.
Paolo Bonzini [Sat, 3 Oct 2009 17:53:31 +0000 (19:53 +0200)]
Add support for Windows CE and various non-x86 CPU types.

14 years agoConditionally emit AM_PROG_CC_C_O invocation to tests/configure.ac.
Bruno Haible [Sat, 3 Oct 2009 16:13:38 +0000 (18:13 +0200)]
Conditionally emit AM_PROG_CC_C_O invocation to tests/configure.ac.

14 years agofchdir: avoid compiler warning
Eric Blake [Sat, 3 Oct 2009 04:32:45 +0000 (22:32 -0600)]
fchdir: avoid compiler warning

Using fchdir without canonicalize-lgpl gave a warning.

* lib/fchdir.c (canonicalize_file_name)
[!HAVE_CANONICALIZE_FILE_NAME]: Avoid compiler warning on mingw.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-open: support mingw errno values
Eric Blake [Sat, 3 Oct 2009 04:40:01 +0000 (22:40 -0600)]
test-open: support mingw errno values

mingw has non-standard errno values for handling directory opens,
but they weren't worth working around in the gnulib modules.

* tests/test-open.h (test_open): Relax test.
* tests/test-fopen.h (test_fopen): Likewise.
* tests/test-openat-safer.c (main): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoopen: fix opening directory on mingw
Eric Blake [Sat, 3 Oct 2009 04:41:54 +0000 (22:41 -0600)]
open: fix opening directory on mingw

open(".",O_WRONLY) used uninitialized memory to decide whether
to succeed or fail - never a good idea ;)

* lib/open.c (open) [REPLACE_OPEN_DIRECTORY]: Correct typo.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-open: on GNU/Hurd, /dev/null is a directory
Eric Blake [Sat, 3 Oct 2009 00:06:21 +0000 (18:06 -0600)]
test-open: on GNU/Hurd, /dev/null is a directory

* tests/test-fopen.h (main): Rename...
(test_fopen): ...to this.  Use a guaranteed non-directory when
confirming open behavior on trailing slash.
* tests/test-openat-safer.c (main): Likewise.
* tests/test-open.h (main): Likewise....
(test_open): ...to this.
* tests/test-fopen.c (main): Adjust caller.
* tests/test-fopen-safer.c (main): Likewise.
* tests/test-open.c (main): Likewise.
* tests/test-fcntl-safer.c (main): Likewise.
Reported by Samuel Thibault.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint: cleanup whitespace in recent commits
Eric Blake [Fri, 2 Oct 2009 19:47:43 +0000 (13:47 -0600)]
maint: cleanup whitespace in recent commits

* lib/fchdir.c (get_name): Remove tabs.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename, fchdir: don't ignore chdir failure
Eric Blake [Fri, 2 Oct 2009 18:05:02 +0000 (12:05 -0600)]
rename, fchdir: don't ignore chdir failure

Although we just checked that chdir(cwd) worked, there is a
race where it could disappear while we are temporarily away.
If that happens, forcefully give up rather than proceeding
in the wrong directory.

* lib/fchdir.c (get_name): Abort on unexpected chdir failure.
* lib/rename.c (rpl_rename) [W32]: Likewise.
(rpl_rename) [RENAME_DEST_EXISTS_BUG]: Avoid one case of losing
an empty destination directory if source cannot be renamed,
although there is still possibility for failure.
* doc/posix-functions/rename.texi (rename): Document the race.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint: cleanup whitespace in recent commits
Eric Blake [Fri, 2 Oct 2009 17:34:53 +0000 (11:34 -0600)]
maint: cleanup whitespace in recent commits

* lib/rename.c (rpl_rename): Remove tabs.
* tests/test-link.h (test_link): Likewise.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorelocatable-prog-wrapper: Add missing dependency on double-slash-root.
Ben Pfaff [Fri, 2 Oct 2009 16:18:16 +0000 (09:18 -0700)]
relocatable-prog-wrapper: Add missing dependency on double-slash-root.

14 years agorenameat: fix Solaris bugs
Eric Blake [Thu, 1 Oct 2009 21:31:32 +0000 (15:31 -0600)]
renameat: fix Solaris bugs

renameat(fd,"file",fd,"name/") failed, just like rename.

* m4/renameat.m4 (gl_FUNC_RENAMEAT): Replace renameat if rename
needed fixing.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): New witness.
* modules/stdio (Makefile.am): Substitute it.
* lib/stdio.in.h (renameat): Declare replacement.
* lib/renameat.c (rpl_renameat): Implement fix.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorenameat: new module
Eric Blake [Mon, 7 Sep 2009 12:45:59 +0000 (06:45 -0600)]
renameat: new module

Passes on Linux and cygwin 1.7 native renameat, and on systems
lacking renameat, but fails on Solaris 9 and 10 for now.

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

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename: fix mingw bugs
Eric Blake [Thu, 1 Oct 2009 22:46:08 +0000 (16:46 -0600)]
rename: fix mingw bugs

Copy various workarounds from cygwin 1.5: rename("dir/.","name"),
rename("dir","file"), rename("dir1","dir2").  Amazingly,
even though mingw stat() has no way to identify hard linked
files, and even though rename("hard1","hard2") destroys the
hard link, the lower-level MoveFileEx does the right thing!

* lib/rename.c (rpl_rename) [W32]: Fix trailing slash and
directory overwrite bugs.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename: fix another cygwin 1.5 bug
Eric Blake [Thu, 1 Oct 2009 17:57:47 +0000 (11:57 -0600)]
rename: fix another cygwin 1.5 bug

Cygwin 1.5 sometimes, but not always, failed on rename("dir1","dir2")
when "dir2" exists.  Beef up the m4 tests to more reliably
detect at least one of cygwin's bugs, in spite of not knowing
why the rename only failed sporadically (thankfully, cygwin 1.7
does not have the bug).  Meanwhile, although NetBSD needs to
share the hard link workarounds, it does not need the trailing
dot and directory workarounds, so split the m4 test into two
separate feature checks.

* m4/rename.m4 (gl_FUNC_RENAME): Split cygwin bugs into two
checks.
* lib/rename.c (rpl_rename): Don't penalize NetBSD with
unnecessary cygwin workarounds.  Also work around bug with moving
full directory onto an empty one.
* modules/rename (Depends-on): Add canonicalize-lgpl, rmdir.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename-dest-slash: merge into rename module
Eric Blake [Sat, 26 Sep 2009 21:18:13 +0000 (15:18 -0600)]
rename-dest-slash: merge into rename module

Tested that NetBSD workaround still passes unit test.

* modules/rename-dest-slash (Status): Mark obsolete.
(Depends-on): Add rename.
(Files): Let rename do it all.
* m4/rename.m4 (gl_FUNC_RENAME): Also test for NetBSD bugs,
subsuming the test from gl_FUNC_RENAME_TRAILING_DEST_SLASH...
* m4/rename-dest-slash.m4: ...so this file can be deleted.
* lib/rename-dest-slash.c (rpl_rename_dest_slash): Delete.
* lib/rename.c (rpl_rename): Update comments.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename: fix cygwin 1.5.x bugs
Eric Blake [Tue, 29 Sep 2009 22:42:59 +0000 (16:42 -0600)]
rename: fix cygwin 1.5.x bugs

On cygwin 1.5.x, rename("dir","file") mistakenly succeeded.
rename("hard1","hard2") mistakenly reduced the hard link count,
such that "hard1" disappears once "hard2" is unlinked.

* m4/rename.m4 (gl_FUNC_RENAME): Detect cygwin bugs.
* lib/rename.c (rpl_rename): Work around them.
* modules/rename (Depends-on): Add same-inode.

14 years agorename: fix Solaris 10 bug
Eric Blake [Thu, 1 Oct 2009 03:57:58 +0000 (21:57 -0600)]
rename: fix Solaris 10 bug

rename("file","name/") mistakenly succeeded.  But since Solaris 10
already obeys POSIX behavior on rename("link/","name"), we avoid
blindly forcing GNU behavior of rejecting symlinks with trailing slash.

* m4/rename.m4 (gl_FUNC_RENAME): Detect Solaris bug.
* lib/rename.c (rpl_rename): Don't cripple POSIX behavior if this
was the only bug.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename: fix Solaris 9 bug
Eric Blake [Wed, 30 Sep 2009 22:19:00 +0000 (16:19 -0600)]
rename: fix Solaris 9 bug

rename("file/","oops") mistakenly succeeded.

* lib/rename.c (rpl_rename): Rewrite to recognize trailing slash
on non-directory.  Avoid calling exit.
* modules/rename (Depends-on): Drop xalloc; add lstat, stdbool,
strdup.
* modules/rename-tests (Depends-on): Drop lstat.
* m4/rename.m4 (gl_FUNC_RENAME): Detect Solaris bug.
(gl_PREREQ_RENAME): Delete unused macro.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename-dest-slash: fix NetBSD bug
Eric Blake [Thu, 1 Oct 2009 00:57:02 +0000 (18:57 -0600)]
rename-dest-slash: fix NetBSD bug

rename("hard1","hard2") mistakenly removed the hard link "hard1".

* lib/rename-dest-slash.c (rpl_rename_dest_slash): Detect hard
links.
* modules/rename-dest-slash (Depends-on): Add same-inode.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agorename-tests: new test, exposes several platform bugs
Eric Blake [Sat, 26 Sep 2009 23:22:15 +0000 (17:22 -0600)]
rename-tests: new test, exposes several platform bugs

This test passes on GNU/Linux, OpenBSD, and Cygwin 1.7.
Elsewhere, this test fails because of at least these bugs:
Solaris 10, cygwin 1.5.x, and mingw all mistakenly succeed on
rename("file","other/").  Solaris 9 and the gnulib replacement
for SunOS 4.1 mistakenly succeed on rename("file/","other").
Cygwin 1.5.x and mingw mistakenly succeed on rename("dir","d/.").
Cygwin 1.5.x and NetBSD 1.6 (even with the gnulib replacement)
mistakenly reduce the link count on rename("hard1","hard2").

* modules/rename-tests: New file.
* tests/test-rename.h: Likewise.
* tests/test-rename.c: Likewise.
* doc/posix-functions/rename.texi (rename): Improve documentation,
including bugs that will eventually be fixed in gnulib.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoAssume version info is available.
Paolo Bonzini [Fri, 2 Oct 2009 11:22:24 +0000 (13:22 +0200)]
Assume version info is available.

14 years agognu-web-doc-update: correct --help output
Jim Meyering [Fri, 2 Oct 2009 10:31:38 +0000 (12:31 +0200)]
gnu-web-doc-update: correct --help output

* build-aux/gnu-web-doc-update: Make --help output relevant.

14 years agognu-web-doc-update: add standard options
Jim Meyering [Fri, 2 Oct 2009 10:05:03 +0000 (12:05 +0200)]
gnu-web-doc-update: add standard options

* build-aux/gnu-web-doc-update: Add --help, --version, etc.

14 years agognu-web-doc-update: New module.
Jim Meyering [Fri, 2 Oct 2009 09:03:48 +0000 (11:03 +0200)]
gnu-web-doc-update: New module.

Use this script to automatically update the on-line web documentation
for your GNU project at http://www.gnu.org/software/$pkg/manual/
* modules/gnu-web-doc-update: New file.
* build-aux/gnu-web-doc-update: New script, from coreutils.
* MODULES.html.sh (Support for maintaining and releasing projects):
Add gnu-web-doc-update.

14 years agolink: LoadLibrary is not needed.
Paolo Bonzini [Fri, 2 Oct 2009 01:04:16 +0000 (03:04 +0200)]
link: LoadLibrary is not needed.

* lib/link.c: Use GetModuleHandle.

14 years agogetopt: bump serial number
Eric Blake [Thu, 1 Oct 2009 12:18:46 +0000 (06:18 -0600)]
getopt: bump serial number

* m4/getopt.m4: Increment serial number, to account for 2009-09-24
change.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotests: tighten link, rmdir, and remove tests
Eric Blake [Tue, 29 Sep 2009 17:40:49 +0000 (11:40 -0600)]
tests: tighten link, rmdir, and remove tests

Catch cygwin bug where rmdir("a/./") failed but rmdir("a/.//")
succeeded.  Be kinder if a Solaris root user runs the test.

* tests/test-link.h (includes): No need to use <config.h> here.
Clean up if directory hard link was created, otherwise test for
trailing '.'.
* tests/test-linkat.c (main): Simplify.
* tests/test-remove.c (main): Enhance test for trailing '.'.
* tests/test-rmdir.h (test_rmdir_func): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agomaint.mk: requiring "make major" was annoying, for a "minor" release.
Jim Meyering [Thu, 1 Oct 2009 08:09:30 +0000 (10:09 +0200)]
maint.mk: requiring "make major" was annoying, for a "minor" release.

What is intended is "stable", to contrast with alpha and beta,
so require "make stable", not "make major".
* build-aux/announce-gen (%valid_release_types): s/major/stable/.
(get_tool_versions): Likewise.
* top/maint.mk (ALL_RECURSIVE_TARGETS): s/major/stable/

14 years agoFix broken build of replacement for Windows tmpfile().
Ben Pfaff [Thu, 1 Oct 2009 04:35:14 +0000 (21:35 -0700)]
Fix broken build of replacement for Windows tmpfile().

14 years agoAvoid identifier clash with POSIX function 'remove' defined as a macro.
Bruno Haible [Mon, 28 Sep 2009 21:25:49 +0000 (23:25 +0200)]
Avoid identifier clash with POSIX function 'remove' defined as a macro.

14 years agodoc: mention yet more cygwin 1.7 status
Eric Blake [Sun, 27 Sep 2009 02:09:38 +0000 (20:09 -0600)]
doc: mention yet more cygwin 1.7 status

* doc/posix-functions/fexecve.texi (fexecve): Now implemented in
cygwin.
* doc/glibc-functions/execvpe.texi (execvpe): New file.
* doc/gnulib.texi (Glibc unistd.h): Mention it.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agoargp: fix test failure
Eric Blake [Sun, 27 Sep 2009 03:32:14 +0000 (21:32 -0600)]
argp: fix test failure

* lib/argp-help.c (hol_entry_cmp): Don't use _tolower on values
that are not upper-case.  Pass correct range to tolower.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agotest-yesno: work around sparc-dash here-document infelicity
Jim Meyering [Sun, 27 Sep 2009 06:41:55 +0000 (08:41 +0200)]
test-yesno: work around sparc-dash here-document infelicity

Without this change, the literal \177 byte in a here document
would make dash 0.5.5.1-3 access uninitialized memory.
* tests/test-yesno.sh: Don't put the \177 byte in the here document.
Instead, use a marker, "@", and filter through tr to create the desired
contents.  Reported as <http://bugs.debian.org/548493> by Kurt Roeckx.

14 years agoDisable untested support for new flavours of ACLs on AIX.
Bruno Haible [Sun, 27 Sep 2009 12:11:54 +0000 (14:11 +0200)]
Disable untested support for new flavours of ACLs on AIX.

14 years agoTypo in comment.
Bruno Haible [Sun, 27 Sep 2009 12:07:26 +0000 (14:07 +0200)]
Typo in comment.

14 years agoAdd support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible [Sun, 27 Sep 2009 12:05:56 +0000 (14:05 +0200)]
Add support for new flavours of ACLs on AIX. (Untested.)

14 years agoargp: fix compilation of getopt
Eric Blake [Sat, 26 Sep 2009 22:28:24 +0000 (16:28 -0600)]
argp: fix compilation of getopt

* lib/getopt.in.h (includes): Use different guard than glibc.
Reported by Sergey Poznyakoff.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodoc: mention more cygwin 1.7 status
Eric Blake [Sat, 26 Sep 2009 15:39:17 +0000 (09:39 -0600)]
doc: mention more cygwin 1.7 status

* doc/posix-functions/access.texi (access): Mention cygwin 1.5
bug.
* doc/posix-functions/execl.texi (execl): Likewise.
* doc/posix-functions/execle.texi (execle): Likewise.
* doc/posix-functions/execlp.texi (execlp): Likewise.
* doc/posix-functions/execv.texi (execv): Likewise.
* doc/posix-functions/execve.texi (execve): Likewise.
* doc/posix-functions/execvp.texi (execvp): Likewise.
* doc/glibc-functions/canonicalize_file_name.texi
(canonicalize_file_name): Cygwin 1.7 now provides this.
* doc/glibc-functions/euidaccess.texi (euidaccess): Likewise.
* doc/posix-functions/fchmodat.texi (fchmodat): Mention limitation
on AT_SYMLINK_NOFOLLOW.

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

14 years agotest-linkat: make test more robust
Eric Blake [Thu, 24 Sep 2009 22:49:49 +0000 (16:49 -0600)]
test-linkat: make test more robust

* tests/test-linkat.c (main): Avoid collision with EEXIST.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agogetopt: fix inclusion guards for cygwin
Eric Blake [Thu, 24 Sep 2009 16:57:14 +0000 (10:57 -0600)]
getopt: fix inclusion guards for cygwin

cygwin <unistd.h> includes <getopt.h>, but gnulib <getopt.h> includes
<unistd.h>, so system declarations were happening after gnulib
replacements, leading to multiply-defined rpl_readlink error on
cygwin 1.5.  The solution is to ensure that the system <unistd.h>
is complete prior to any of gnulib's contents, by picking up
system <getopt.h> in preference to a cycle to <unistd.h>.

* modules/getopt-posix (Depends-on): Add include-next.
(Makefile.am): Substitute more items in replacement header.
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Also check for native
<getopt.h>.
* lib/getopt.in.h (includes): Use split inclusion guard, and
prefer <getopt.h> over include <unistd.h> when one is present.
(option): Also override name of 'struct option'.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agosame-inode: revert prior change; it is not yet ready
Eric Blake [Thu, 24 Sep 2009 11:51:28 +0000 (05:51 -0600)]
same-inode: revert prior change; it is not yet ready

This reverts commit b5eb8386645bf1bcfafa63c729ff9a86454def87.

* NEWS: Undo mention of this change.
* lib/same-inode.h (same-inode.h): Undo tri-state change.
* lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
* lib/cycle-check.c (cycle_check): Likewise.
* lib/same.c (same_name): Likewise.
* lib/at-func2.c (at_func2): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agolinkat: new module
Eric Blake [Wed, 9 Sep 2009 02:47:40 +0000 (20:47 -0600)]
linkat: new module

* modules/linkat: New file.
* lib/at-func2.c (at_func2): Likewise.
* lib/linkat.c (linkat): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* lib/openat-priv.h (at_func2): Add declaration.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witnesses.
* modules/unistd (Makefile.am): Substitute them.
* lib/unistd.in.h (linkat): Declare it.
* MODULES.html.sh (systems lacking POSIX:2008): Mention module.
* doc/posix-functions/linkat.texi (linkat): Likewise.
* doc/posix-functions/link.texi (link): Tweak wording.
* tests/test-link.c (main): Move guts...
* tests/test-link.h (test_link): ...into new file.
* modules/linkat-tests: New test.
* tests/test-linkat.c: Likewise.
* modules/link-tests (Files): Ship new file.
(Depends-on): Add stdbool.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agodirname: add library-safe mdir_name
Eric Blake [Wed, 9 Sep 2009 12:24:28 +0000 (06:24 -0600)]
dirname: add library-safe mdir_name

A library-safe dir_name is nice, especially alongside
mfile_name_concat.  Someday, we should rearrange the .o
files so that linking in mdir_name does not suck in
xalloc_die, but for now, the only planned client of
mdir_name (at-func2) is already using xalloc_die.

* lib/dirname.h (mdir_name): New prototype.
* lib/dirname.c (dir_name): Move guts...
(mdir_name): ...to new function that avoids xalloc_die.

Signed-off-by: Eric Blake <ebb9@byu.net>
14 years agofchdir: another mingw fix
Eric Blake [Thu, 24 Sep 2009 02:33:40 +0000 (20:33 -0600)]
fchdir: another mingw fix

canonicalize_file_name does not understand drive letters or
backslash.  The only reason openat required it was to make
fchdir get the canonical name of a directory.  But we can do
the same trick with chdir and getcwd.  With this fix,
fchdir(open("..",O_RDONLY)) finally does the right thing on mingw.

* modules/fchdir (Depends-on): Drop canonicalize-lgpl.
* lib/fchdir.c (get_name): New helper method; skips canonicalize
on mingw (where it has not yet been ported), and make it optional
elsewhere.
(_gl_register_fd): Use it.

Signed-off-by: Eric Blake <ebb9@byu.net>
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}})