diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-04-02 01:43:12 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-04-02 01:43:12 +0000 |
commit | ebf53ef2a2d51dbd57a8cfac9d769544a73eb37a (patch) | |
tree | bbec1bd004bc0a7b0d4df54b33e0d78eb0b508d5 | |
parent | d614ea3e8b1d28f8d9a848beb2c2ce5e3c3ed4d0 (diff) | |
download | automake-ebf53ef2a2d51dbd57a8cfac9d769544a73eb37a.tar.gz |
* lib/install-sh: If "mv -f" works, use it.
-rw-r--r-- | ChangeLog | 10 | ||||
-rwxr-xr-x | lib/install-sh | 49 |
2 files changed, 39 insertions, 20 deletions
@@ -1,3 +1,13 @@ +2004-04-01 Paul Eggert <eggert@twinsun.com> + + * 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). + 2004-03-26 Alexandre Duret-Lutz <adl@gnu.org> * m4/python.m4 (AM_PATH_PYTHON): Make sure am_display_PYTHON is diff --git a/lib/install-sh b/lib/install-sh index 77bc38144..e4160c991 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-02-15.20 +scriptversion=2004-04-01.17 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -280,26 +280,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 |