autoconf-patches
[Top][All Lists]
Advanced

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

Re: pending Autoconf + Automake patches


From: Paul Eggert
Subject: Re: pending Autoconf + Automake patches
Date: Thu, 11 May 2006 12:55:15 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Alexandre Duret-Lutz <address@hidden> writes:

>  RW> Paul's install-sh race condition fix:
>  RW> http://lists.gnu.org/archive/html/automake/2006-04/msg00136.html
>
> This looks fine to me, you really shouldn't have waited after me.

OK, thanks, in that spirit I installed the following change into
Automake, to sync install-sh with Autoconf.  This implements the
above-mentioned change in a nicer way on pre-Posix hosts, and also
fixes a minor violation of the GNU coding standards.

2006-05-11  Paul Eggert  <address@hidden>

        * lib/install-sh: Sync from Autoconf, as follows:
        Don't use 'path' to talk about file names,
        as per GNU coding standards.  Close a race condition reported by Ralf
        Wildenhues and Stepan Kasal.  There is still a race condition
        on hosts that predate Posix 1003.1-1992, but we can't help this.
        Don't mishandle weird characters like space on pre-Posix hosts.
        Invoke mkdir at most once per dir arg on pre-Posix hosts.

--- lib/install-sh      11 May 2006 17:28:08 -0000      1.33
+++ lib/install-sh      11 May 2006 19:51:25 -0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-05-11.19
+scriptversion=2006-05-11.20
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -51,7 +51,8 @@ IFS=" ""      $nl"
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
@@ -315,9 +316,9 @@ do
       # step, checking for races as we go.
 
       case $dstdir in
-       /*) pathcomp=/ ;;
-       -*) pathcomp=./ ;;
-       *)  pathcomp= ;;
+       /*) prefix=/ ;;
+       -*) prefix=./ ;;
+       *)  prefix= ;;
       esac
 
       case $posix_glob in
@@ -337,19 +338,36 @@ do
       $posix_glob && set +f
       IFS=$oIFS
 
+      prefixes=
+
       for d
       do
-       test "x$d" = x && continue
+       test -z "$d" && continue
 
-       pathcomp=$pathcomp$d
-       if test ! -d "$pathcomp"; then
-         $mkdirprog "$pathcomp"
-         # Don't fail if two instances are running concurrently.
-         test -d "$pathcomp" || exit 1
+       prefix=$prefix$d
+       if test -d "$prefix"; then
+         prefixes=
+       else
+         if $posix_mkdir; then
+           $mkdirprog -m "$mkdir_mode" -p -- "$dstdir" && break
+           # Don't fail if two instances are running concurrently.
+           test -d "$prefix" || exit 1
+         else
+           case $prefix in
+             *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+             *) qprefix=$prefix;;
+           esac
+           prefixes="$prefixes '$qprefix'"
+         fi
        fi
-       pathcomp=$pathcomp/
+       prefix=$prefix/
       done
-      obsolete_mkdir_used=true
+
+      if test -n "$prefixes"; then
+       # Don't fail if two instances are running concurrently.
+       eval "\$mkdirprog $prefixes" || test -d "$dstdir" || exit 1
+       obsolete_mkdir_used=true
+      fi
     fi
   fi
 




reply via email to

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