1. 10 Oct, 2009 19 commits
    • Eric Blake's avatar
      futimens: new module · 959d9cb4
      Eric Blake authored
      Provides futimens where it is missing, and rpl_futimens to work
      around bugs in older Linux kernels.
      
      * modules/futimens: New file.
      * lib/futimens.c (futimens): Likewise.
      * m4/futimens.m4 (gl_FUNC_FUTIMENS): Likewise.
      * lib/utimens.c (futimens): Avoid recursion into rpl_futimens, so
      we can work around Linux bugs.
      * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Add witnesses.
      * modules/sys_stat (Makefile.am): Substitute them.
      * lib/sys_stat.in.h (futimens): Declare it.
      * MODULES.html.sh (systems lacking POSIX:2008): Mention module.
      * doc/posix-functions/futimens.texi (futimens): Likewise.
      * modules/futimens-tests: New test.
      * tests/test-futimens.c: Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      959d9cb4
    • Eric Blake's avatar
      utimens: introduce fdutimens · aba35168
      Eric Blake authored
      at-func.c wants the file name argument first.  This also paves the
      way to add fdutimensat(dfd,name,fd,times,flag).
      
      * lib/utimens.h (fdutimens): New prototype.
      * lib/utimens.c (gl_futimens): Move guts...
      (fdutimens): ...to new interface.
      * tests/test-utimens.c (do_fdutimens): Use it.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      aba35168
    • Eric Blake's avatar
      utimens: add UTIME_NOW and UTIME_OMIT support · 080cbfca
      Eric Blake authored
      These flags make it possible to implement futimens and utimensat;
      they also make touch(1) more efficient, by avoiding stat or
      gettime if native utimensat works.
      
      * lib/utimens.c (validate_timespec, update_timespec): New helper
      functions.
      (gl_futimens, lutimens): Use them.
      * modules/utimens (Depends-on): Add gettime, lstat, stat-time,
      stdbool, sys_stat.
      (Link): Mention resulting library dependency.
      * modules/utimecmp (Link): Likewise.
      * modules/utimens-tests (Depends-on): Drop stat-time, stdbool.
      (Makefile.am): Pick up library dependency.
      * lib/sys_stat.in.h (UTIME_NOW, UTIME_OMIT): Guarantee a
      definition.
      * tests/test-sys_stat.c: Test the definitions.
      * doc/posix-headers/sys_stat.texi (sys/stat.h): Document this.
      * NEWS: Document library dependency.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      080cbfca
    • Eric Blake's avatar
      utimecmp: support symlink timestamps · 4a060c0d
      Eric Blake authored
      Update this module to reflect POSIX 2008:
      With pathconf, we can avoid calling utimens.
      With utimensat, the system resolution can be 1.
      With lutimens, we can determine resolution on symlinks.
      
      * lib/utimecmp.c (utimecmp): Use new interface.  Skip effort of
      hashing when possible.  Use pathconf when available.
      (SYSCALL_RESOLUTION): Recognize tighter resolution.
      * modules/utimecmp (Depends-on): Add lstat.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      4a060c0d
    • Eric Blake's avatar
      utimens: add lutimens interface · 2726b8f4
      Eric Blake authored
      Wraps utimensat(,AT_SYMLINK_NOFOLLOW) or lutimes, when supported;
      otherwise fail with ENOSYS.  Allows coreutils' copy.c to preserve
      symlink timestamps on more systems.  Note that cygwin's lstat
      changes atime of symlinks, but mtime can reliably be set.
      
      * lib/utimens.c (lutimens): New function.
      * m4/utimens.m4 (gl_UTIMENS): Check for lutimes.
      * lib/utimens.h (lutimens): Declare new interface.
      * tests/test-utimens.c (main): Enhance test.
      * tests/test-lutimens.h (test_lutimens): New file.
      * modules/utimens-tests (Files): Distribute it.
      (Depends-on): Add symlink.
      (configure.ac): Check for usleep.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      2726b8f4
    • Eric Blake's avatar
      utimens: validate futimens usage · d71f5056
      Eric Blake authored
      Using gl_futimens(fd,NULL,times) as an implementation for futimens
      won't work unless we reliably detect EBADF for out-of-range fd.
      Also catches a Linux bug with futimens(AT_FDCWD,NULL) changing ".".
      mingw <utime.h> has a bug where utime's second argument is not const.
      
      * lib/utimens.c (gl_futimens): Require valid fd up front, using
      fewer syscalls on failure later on.  Avoid compiler warning on
      mingw.
      * modules/utimens (Depends-on): Add dup2.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      d71f5056
    • Eric Blake's avatar
      utimens: add test · 30dc6636
      Eric Blake authored
      Exposes holes in our API, and several platform bugs.
      
      * modules/utimens-tests: New test.
      * tests/test-utimens.h: New file.
      * tests/test-futimens.h: Likewise.
      * tests/test-utimens.c: Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      30dc6636
    • Eric Blake's avatar
      doc: mention timestamp portability issues · 75de3afe
      Eric Blake authored
      * doc/glibc-functions/lutimes.texi (lutimes): Refer to utimensat
      instead.
      * doc/posix-functions/utime.texi (utime): Likewise.
      * doc/posix-functions/utimes.texi (utimes): Likewise.
      * doc/glibc-functions/futimes.texi (futimes): Refer to futimens
      instead.
      * doc/posix-functions/futimens.texi (futimens): Mention utimens
      module.
      * doc/posix-functions/utimensat.texi (utimensat): Likewise.
      Mention weakness with symlink timestamps.
      * doc/glibc-functions/futimesat.texi (futimesat): New file; refer
      to utimensat/futimens instead.
      * doc/gnulib.texi (Glibc sys/time.h): Include new file.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      75de3afe
    • Eric Blake's avatar
      test-dup2: enhance test · b2fb3b5d
      Eric Blake authored
      AT_FDCWD is only supposed to be special in *at functions.
      
      * tests/test-dup2.c (main): Also check AT_FDCWD.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      b2fb3b5d
    • Eric Blake's avatar
      test-stat-time: avoid more spurious failures · 3776abf8
      Eric Blake authored
      On xfs, although timestamps can have a full nanosecond resolution,
      successive file actions appear to be quantized to approximately
      10 millisecond windows.  Running with just 1 ms delays could
      cause two actions to fall in the same window, leading to sporadic
      failures on a fast enough machine.  Slow down to prevent this.
      
      On ext2, timestamps only have 1 second resolution, but if the
      first timestamp was made at 1.95 and the second at 2.10, then
      the two files appear 1 second apart, and the shorter delay was
      used, causing spurious failures.  Require that the observable
      difference lie within the same second, using a second try if
      necessary, to prevent this.
      
      * tests/test-stat-time.c (nap): Wait for 15ms rather than 2ms, for
      xfs; and avoid race if the two timestamps cross quantization edge.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      3776abf8
    • Eric Blake's avatar
      relocatable: prefer 'file system' over 'filesystem' · d93391bf
      Eric Blake authored
      * m4/relocatable-lib.m4 (gl_RELOCATABLE_NOP): Use AS_HELP_STRING.
      (gl_RELOCATABLE_LIBRARY_BODY): Fix spelling.
      * doc/relocatable-maint.texi (Supporting Relocation): Likewise.
      * doc/relocatable.texi (Enabling Relocatability): Likewise.
      * lib/relocatable.c (compute_curr_prefix): Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      d93391bf
    • Jim Meyering's avatar
      stat-time-tests: check for the usleep function · fd35e151
      Jim Meyering authored
      * modules/stat-time-tests (configure.ac): Now that we test HAVE_USLEEP.
      fd35e151
    • Bruno Haible's avatar
      Typo in ChangeLog entry. · e1aaa1ba
      Bruno Haible authored
      e1aaa1ba
    • Bruno Haible's avatar
      005ce790
    • Eric Blake's avatar
      dup2: work around FreeBSD 6.1 bug · b5b8e4ac
      Eric Blake authored
      dup2(1,1000000) needs to fail with EBADF (per POSIX), not
      EMFILE, based on our usage of it in other modules.
      
      * m4/dup2.m4 (gl_FUNC_DUP2): Detect bug.
      * doc/posix-functions/dup2.texi (dup2): Document it.
      Reported by Nelson H. F. Beebe and Jim Meyering.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      b5b8e4ac
    • Eric Blake's avatar
      test-stat-time: port to buggy NFS clients · f9f3206e
      Eric Blake authored
      On darwin, the NFS client reports mtime with st_sec==INT_MAX and
      st_nsec monotonically increasing per transaction until the next
      sync(); but sync() is expensive, so it is easier to just skip
      this part of the test if mtime is nowhere near ctime.
      
      * tests/test-stat-time.c (main) [W32]: Reduce ifdefs.
      (test_ctime): Also skip test if mtime and ctime are skewed.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      f9f3206e
    • Eric Blake's avatar
      maint: prefer 'file system' over 'filesystem' · 231bdaf6
      Eric Blake authored
      * doc/posix-functions/fstatat.texi (fstatat): Likewise.
      * doc/posix-functions/lstat.texi (lstat): Likewise.
      * lib/file-has-acl.c (file_has_acl): Likewise.
      * lib/fwriteerror.c [TEST]: Likewise.
      * tests/test-areadlink.h (test_areadlink): Likewise.
      * tests/test-areadlinkat-with-size.c (main): Likewise.
      * tests/test-areadlinkat.c (main): Likewise.
      * tests/test-canonicalize-lgpl.c (main): Likewise.
      * tests/test-canonicalize.c (main): Likewise.
      * tests/test-fstatat.c (main): Likewise.
      * tests/test-linkat.c (main): Likewise.
      * tests/test-lstat.h (test_lstat_func): Likewise.
      * tests/test-mkdir.h (test_mkdir): Likewise.
      * tests/test-readlink.h (test_readlink): Likewise.
      * tests/test-remove.c (main): Likewise.
      * tests/test-rename.h (test_rename): Likewise.
      * tests/test-renameat.c (main): Likewise.
      * tests/test-rmdir.h (test_rmdir_func): Likewise.
      * tests/test-symlink.h (test_symlink): Likewise.
      * tests/test-symlinkat.c (main): Likewise.
      * tests/test-unlink.h (test_unlink_func): Likewise.
      * tests/test-unlinkat.c (main): Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      231bdaf6
    • Eric Blake's avatar
      maint: make realtime library usage explicit · 0dc2838b
      Eric Blake authored
      Adding a Link section makes it easier to notice when it a module
      may require edits to a user's Makefile.am.
      
      * modules/gethrxtime (Link): Mention LIB_GETHRXTIME.
      * modules/gettime (Link): Mention LIB_CLOCK_GETTIME.
      * modules/settime (Link): Likewise.
      * modules/xnanosleep (Link): Mention LIB_NANOSLEEP.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      0dc2838b
    • Eric Blake's avatar
      test-stat-time: speed up execution · 4e42b89b
      Eric Blake authored
      Eight seconds was painfully long.
      
      * tests/test-stat-time.c (test_ctime) [!W32]: Avoid compiler
      warning on mingw.
      (nap): New helper function.
      (prepare_test): Use it to reduce sleep time.
      (test_mtime, test_ctime, test_birthtime): Allow for subsecond
      execution.
      * modules/stat-time-tests (configure.ac): Check for usleep.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      4e42b89b
  2. 09 Oct, 2009 3 commits
    • Jim Meyering's avatar
      selinux-h: always use getfilecon wrappers · f4dc8062
      Jim Meyering authored
      * lib/getfilecon.c: New file.
      * lib/se-selinux.in.h: Use a better inclusion guard symbol name.
      [HAVE_SELINUX_SELINUX_H]: Include-next <selinux/selinux.h>.
      [!HAVE_SELINUX_SELINUX_H]: Use better parameter names.
      (fgetfilecon): Provide a stub.
      * m4/selinux-selinux-h.m4 (gl_HEADERS_SELINUX_SELINUX_H): Don't
      AC_SUBST SELINUX_SELINUX_H, since now we're generating that
      file unconditionally.
      When <selinux/selinux.h> is found, arrange to use wrappers.
      * modules/selinux-h (Files): Add getfilecon.c.
      (Makefile.am): Substitute include-next-related bits
      into the now-always-generated selinux/selinux.h file.
      * doc/glibc-functions/getfilecon.texi: New file.
      * doc/glibc-functions/lgetfilecon.texi: New file.
      * doc/glibc-functions/fgetfilecon.texi: New file.
      * doc/glibc-functions/getfilecon-desc.texi: New file.
      * doc/gnulib.texi (Glibc selinux/selinux.h): New section, by
      which to pull in the new files.
      * MODULES.html.sh (Misc): Add selinux-h.
      f4dc8062
    • Jim Meyering's avatar
      unistd: fix comment typo · d984c0bc
      Jim Meyering authored
      * lib/unistd.in.h (euidaccess): Fix a comment typo.
      d984c0bc
    • Eric Blake's avatar
      areadlink: use SIZE_MAX consistently · 2ee3ac7f
      Eric Blake authored
      * modules/areadlink (Depends-on): Add stdint.
      * modules/areadlink-with-size (Depends-on): Likewise.
      * lib/areadlink-with-size.c (includes): Drop stdio, since stdlib
      gives NULL; drop sys/types, since unistd gives size_t; and add
      stdint for SIZE_MAX.
      (SIZE_MAX): Rely on headers.
      * lib/areadlinkat-with-size.c (includes): Drop stdio, sys/types,
      and add stdint.
      * lib/areadlink.c (includes): Drop sys/types, and add stdint.
      (SIZE_MAX): Likewise.
      (INITIAL_BUF_SIZE): Turn into enum.
      * lib/areadlinkat.c (INITIAL_BUF_SIZE): Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      2ee3ac7f
  3. 08 Oct, 2009 8 commits
    • Karl Berry's avatar
      autoupdate · fd67d661
      Karl Berry authored
      fd67d661
    • Jim Meyering's avatar
      areadlinkat: avoid compilation failure · 01b49fe4
      Jim Meyering authored
      * lib/areadlinkat.c: Include <stdint.h> for use of SIZE_MAX.
      Fix typo in comment.
      01b49fe4
    • Eric Blake's avatar
      areadlinkat-with-size: new module · daa06b99
      Eric Blake authored
      * modules/areadlinkat-with-size: New module.
      * lib/areadlinkat-with-size.c (areadlinkat_with_size): New file.
      * lib/areadlink.h (areadlinkat): Declare it.
      * MODULES.html.sh (File system functions): Mention it.
      * modules/areadlinkat-with-size-tests: New test.
      * tests/test-areadlinkat-with-size.c: New file.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      daa06b99
    • Eric Blake's avatar
      xreadlinkat: new module · 25148dfa
      Eric Blake authored
      * modules/xreadlinkat: New module.
      * lib/xreadlinkat.c (xreadlinkat): New file.
      * lib/xreadlink.h (xreadlinkat): Declare it.
      * MODULES.html.sh (File system functions): Mention it.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      25148dfa
    • Eric Blake's avatar
      areadlinkat: new module · 9d145640
      Eric Blake authored
      * lib/at-func.c (FUNC_FAIL): New define.
      (AT_FUNC_NAME, VALIDATE_FLAG): Use it rather than raw -1.
      * modules/areadlinkat: New module.
      * lib/linkat.c (areadlinkat): Move...
      * lib/areadlinkat.c (areadlinkat): ...to new file.
      * lib/areadlink.h (areadlinkat): Declare it.
      * modules/linkat (Depends-on): Add areadlinkat.
      * MODULES.html.sh (File system functions): Mention it.
      * modules/areadlinkat-tests: New test.
      * tests/test-areadlinkat.c: New file.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      9d145640
    • Eric Blake's avatar
      areadlink, areadlink-with-size: add tests · 87e03169
      Eric Blake authored
      * modules/areadlink-tests: New test.
      * modules/areadlink-with-size-tests: Likewise.
      * tests/test-areadlink.h: New file.
      * tests/test-areadlink.c: Likewise.
      * tests/test-areadlink-with-size.c: Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      87e03169
    • Eric Blake's avatar
      maint: minor cleanups · 35335a0a
      Eric Blake authored
      * lib/fts.c (ATTRIBUTE_UNUSED): Delete; use gnulib-guaranteed
      _ATTRIBUTE_UNUSED instead.
      * lib/getdate.y (ATTRIBUTE_UNUSED): Likewise.
      * lib/utimens.c (ATTRIBUTE_UNUSED): Likewise.
      * modules/linkat-tests (Files): Distribute test-link.h.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      35335a0a
    • Eric Blake's avatar
      openat, utimens: whitespace cleanup · 4563696d
      Eric Blake authored
      * lib/openat.c: Prefer space throughout, rather than mix of 8
      spaces vs. tabs.
      * lib/at-func.c: Likewise.
      * lib/utimens.c: Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      4563696d
  4. 07 Oct, 2009 10 commits
    • Eric Blake's avatar
      openat: avoid using wrong fd · 100bccc4
      Eric Blake authored
      Detected by a Solaris failure on:
      int fd = dup (0);
      close (fd);
      mkdirat (fd, "dir", 0700);
      which created "./dir" instead of failing with EBADF.
      
      * lib/openat.c (openat_permissive): Reject user's fd if saving the
      working directory chooses same fd.
      * lib/at-func.c (AT_FUNC_NAME): Likewise.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      100bccc4
    • Eric Blake's avatar
      mkdir, mkdirat: fix cygwin 1.5.x bug · cb7317d7
      Eric Blake authored
      mkdir("dir/./",mode) mistakenly succeeded.
      
      * lib/mkdir.c (rpl_mkdir) [FUNC_MKDIR_DOT_BUG]: Work around bug.
      * m4/mkdir-slash.m4 (gl_FUNC_MKDIR_TRAILING_SLASH): Move...
      * m4/mkdir.m4 (gl_FUNC_MKDIR): ...here, and add check for cygwin
      bug.
      (gl_PREREQ_MKDIR): Delete unused macro.
      * modules/mkdir (Files): Track file rename.
      (configure.ac): Update macro name.
      * modules/openat (Depends-on): Add mkdir.
      * doc/posix-functions/mkdir.texi (mkdir): Document the bug.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      cb7317d7
    • Eric Blake's avatar
      mkdir, mkdirat: add tests · da8f2a56
      Eric Blake authored
      This test exposes failures on cygwin 1.5 and in our mkdirat emulation.
      
      * modules/mkdir-tests: New test.
      * tests/test-mkdir.h: New file.
      * tests/test-mkdir.c: Likewise.
      * tests/test-mkdirat.c: Likewise.
      * modules/openat-tests (Files): Add new files.
      (Makefile.am): Run new test.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      da8f2a56
    • Eric Blake's avatar
      doc: tweak *at function documentation · 396ef4ef
      Eric Blake authored
      * 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: default avatarEric Blake <ebb9@byu.net>
      396ef4ef
    • Eric Blake's avatar
      openat: fix GNU/Hurd bug in unlinkat · 3cfa8707
      Eric Blake authored
      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: default avatarEric Blake <ebb9@byu.net>
      3cfa8707
    • Eric Blake's avatar
      fdopendir: fix GNU/Hurd bug · dfbec8be
      Eric Blake authored
      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: default avatarEric Blake <ebb9@byu.net>
      dfbec8be
    • Eric Blake's avatar
      test-symlink: port to GNU/Hurd · 48b0feac
      Eric Blake authored
      * tests/test-symlink.h (test_symlink): Relax expected errno.
      Signed-off-by: default avatarEric Blake <ebb9@byu.net>
      48b0feac
    • Eric Blake's avatar
      doc: tweak more cygwin information · b46dd7ed
      Eric Blake authored
      * 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: default avatarEric Blake <ebb9@byu.net>
      b46dd7ed
    • Eric Blake's avatar
      getopt-gnu: add another test · 497ec25b
      Eric Blake authored
      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: default avatarEric Blake <ebb9@byu.net>
      497ec25b
    • Eric Blake's avatar
      getopt: fix compilation on darwin · 09e22b5a
      Eric Blake authored
      * 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: default avatarEric Blake <ebb9@byu.net>
      09e22b5a