[Top][All Lists]

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

Re: bootstrap symlink dependencies

From: Paul Eggert
Subject: Re: bootstrap symlink dependencies
Date: Sat, 14 May 2011 01:07:22 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110424 Thunderbird/3.1.10

> If something treats symlink mtime as significant,
> then I suspect that it's at fault.

Yes, there's something busted there.  GNU 'make' does the right thing:
it follows symlinks when checking time stamps.  Is some other 'make'
is being used, or perhaps some tool other than 'make'?

> That looks like a good change to me, but maybe
> Paul (the author of that part, I think) knows more.

Well, if my (admittedly vague) memory serves, the checks are present
for the opposite problem with broken 'make' implementations, where
they do unnecessary work merely because symlink timestamps changed.

> Alternatively, avoid a subshell+ls while retaining semantics like this:
> (untested)
>   inums=`ls -diL "$src" 2>/dev/null` && set $inums &&
>   test "$1" = "$3" || {

I assumme you meant 'ls -diL "$src" "$dst"' there?  But this won't
work if the file names contain spaces.

> If we did want to maintain the symlink timestamps for some reason,
> then I suppose we could do something like the following,
> but I'm unsure as how to do this best portably.

We can use 'ls' rather than 'stat'.  Something like the following, perhaps?
(I haven't tested it.)

diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index d32db57..b6dacb7 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -670,10 +670,17 @@ symlink_to_dir()
         cp -fp "$src" "$dst"
+      # Leave any existing symlink alone, if it already points to the source,
+      # so that broken 'make' implementations that care about symlink times
+      # aren't confused into doing unnecessary builds.  Conversely, if the
+      # existing symlink's time stamp is older than the source, make it afresh,
+      # so that broken 'make's aren't confused into skipping needed builds.
       test -h "$dst" &&
       src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
       dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
-      test "$src_i" = "$dst_i" || {
+      test "$src_i" = "$dst_i" &&
+      both_ls=`ls -dt "$src" "$dst"` &&
+      test "X$both_ls" = "X$dst$nl$src" || {
         case $src in
         /*) ;;

reply via email to

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