bug-coreutils
[Top][All Lists]
Advanced

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

Re: Problem installing coreutils-5.2.1 over the same prefix


From: Paul Eggert
Subject: Re: Problem installing coreutils-5.2.1 over the same prefix
Date: Thu, 01 Apr 2004 13:37:57 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

DervishD <address@hidden> writes:

> I've downloaded and installed coreutils-5.2.1 and the 'make
> install-strip' command fails when installing 'mv', since old /bin/mv
> (I install my coreutils in prefix '/')

Wow!  You're brave.

> is removed by 'config/install-sh' when it is still needed.

Thanks for reporting that.  Here is a proposed patch to Automake's
install-sh to handle this case.

2004-04-01  Paul Eggert  <address@hidden>

        * lib/install-sh: If "mv -f" works, use it, and fall back to
        the old "test -f" + "rm -f" + "mv" method only if "mv -f" does
        not work.  This improves performance in the usual case where
        "mv -f" works.  It also lets us install the "mv" command
        without worrying about a small window where "mv" does not
        exist (this problem was reported by Raul Nunez de Arenas
        Coronado).

Index: install-sh
===================================================================
RCS file: /home/meyering/coreutils/cu/config/install-sh,v
retrieving revision 1.14
diff -p -u -r1.14 install-sh
--- install-sh  19 Jan 2004 17:53:12 -0000      1.14
+++ install-sh  1 Apr 2004 21:27:20 -0000
@@ -274,26 +274,35 @@ do
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
       && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
 
-    # Now remove or move aside any old file at destination location.  We
-    # try this two ways since rm can't unlink itself on some systems and
-    # the destination file might be busy for other reasons.  In this case,
-    # the final cleanup might fail but the new file should still install
-    # successfully.
-    {
-      if test -f "$dstdir/$dstfile"; then
-        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
-        || {
-         echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-         (exit 1); exit
-        }
-      else
-        :
-      fi
-    } &&
-
     # Now rename the file to the real destination.
-    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
   fi || { (exit 1); exit; }
 done
 




reply via email to

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