bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch to add microsecond resolution support to cp -p, etc.


From: Jim Meyering
Subject: Re: patch to add microsecond resolution support to cp -p, etc.
Date: Sat, 09 Aug 2003 20:21:30 +0200

"Paul Eggert" <address@hidden> wrote:
> Sun patch 109933-02 for Solaris 8 sparc, released August 1, added
> support to "cp -p" to set file timestamps to microsecond resolution,
> instead of the old behavior, which set them only to 1-second
> resolution.  Sun "make" relies on this new behavior so that "make"
> actions like "dest: source; cp -p source dest" do not confuse "make".
>
> Here is a patch to add this capability to GNU coreutils.
>
> 2003-08-06  Paul Eggert  <address@hidden>
>
>       * NEWS: Add support for setting file timestamps to microsecond
>       resolution, on hosts that support this.
>       * lib/Makefile.am (libeftish_a_SOURCES): Add utimens.c, utimens.h.
>       * lib/utimens.c, lib/utimens.h: New files.
>       * m4/prereq.m4 (jm_PREREQ): Require gl_UTIMENS.
>       * m4/timespec.m4: Sync with gnulib.
>       * m4/utimens.m4: New file.
>       * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include timespec.h.
>       * src/copy.c (copy_internal):
>       Set file timestamps with utimens, not utimes.
>       * src/cp.c (re_protect): Likewise.
>       * src/install.c (change_timestamps): Likewise.
>       * src/touch.c (newtime, touch, main): Likewise.
...
> diff -Naurp coreutils/src/copy.c coreutils-cp-p/src/copy.c
> --- coreutils/src/copy.c      2003-07-22 23:38:18.000000000 -0700
> +++ coreutils-cp-p/src/copy.c 2003-08-06 17:21:52.489506000 -0700

Thanks for those changes!
I've applied most of them.

In particular, I've changed this:

  * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include timespec.h.
to
  Include utimens.h.

That exposed a little problem.
I've removed a few of the leading `&' like this one:

> +      if (utimens (dst_path, &timespec))

More importantly, utimes doesn't seem to work on my
system (linux-2.4.21, libc-2.3.2) so I'm changing your patch
to check for utime (not utimes) and use utimes only if `! HAVE_UTIME'.

Besides, before your change, touch used `utime' unconditionally.
Why does utimens.c bother with utimes at all?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]