[Top][All Lists]

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

Re: ``install -C'' / unnecessarily updating time stamps

From: Akim Demaille
Subject: Re: ``install -C'' / unnecessarily updating time stamps
Date: Tue, 26 Dec 2006 11:35:08 +0100

Le 25 déc. 06 à 11:46, Thomas Schwinge a écrit :

[I added the patch's author, Akim Demaille, to the cc list, as it was not
sure if he's still reading the list.]

You're right, I'm not.


Hi, and merry Chrismas.

On Sun, Dec 24, 2006 at 04:21:50PM -0800, Paul Eggert wrote:
Benoit Sigoure <address@hidden> writes: msg00070.html

Sorry, I missed that one.  The idea looks reasonable, but that solves
the problem for install-sh only, right?  GNU 'install' still wouldn't
support -C.

This brings up the following question: if `-C' shall be used a) by
default in Autoconf's `AC_PROG_INSTALL' if available or b) if requested
by the programmer through setting some flag, and `install-sh' supports
`-C', but the system's `install' executable doesn't (which will, as far as I can tell, be the case on most systems as after this quoted patch has
been applied to `install-sh'), which of the two installation programs
shall be chosen: the native `install' for speed or `install-sh' for
feature completeness and to accommodate the programmer's request?

I agree with Paul's answer.  Besides, it is IMHO high time to completely
rewrite AC_PROG_INSTALL to actually check the behavior of "install"
instead of playing dark magic with file names.  It would be nice then
to be able to specify the flags one wants (e.g., -C).

Also, the updated patch proposed in
< msg00077.html>
has some coding-style components along with the substance components.
I plan to split it into two and apply the two pieces.

| +    # Maybe we don't need to install the file.  Use diff, not cmp,
| +    # to be robust to end-of-line encoding.
| +    { if $copy_on_change &&
| +      $diffprog "$dsttmp" "$dst" >/dev/null 2>&1 &&
| +      new=`ls -l "$dsttmp" | awk '{print $1 ":" $3 ":" $4}'` &&
| +      old=`ls -l "$dst"    | awk '{print $1 ":" $3 ":" $4}'` &&
| +      test x"$new" = x"$old"
| +      then
| +     # No need to copy, that's the same file.
| +     continue
| +      else :; fi; } &&

Is this ``ls -l [...] | awk [...]'' portable enough


and is it really

Either you do that, or chmod afterwards.  But install-sh behaves
quite atomically and either fully does its job, or leaves the
destination untouched.

Besides, if you just happened to have removed some read permissions,
it seems fair that all the files that depend on it no longer
compile.  So the timestamps and Makefiles should not continue
as if nothing happened.

But that's a weak argument, I don't really care.

Another option I was considering was adding -I to be passed to
diff.  For instance to ignore $Id$ keywords etc.  But if no
real "install" support it, who cares.

| #v+
| [...]
| -C Copy the file. If the target file already exists and the files | are the same, then do not change the modification time of the | target. If the target's file flags and mode need not to be | changed, the target's inode change time is also unchanged.
| [...]
| #v-


reply via email to

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