+2006-05-11 Paul Eggert <eggert@cs.ucla.edu>
+
+ * 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.
+
2006-05-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tests/missing.test, tests/missing2.test: Do not require
#!/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
# 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}"
# step, checking for races as we go.
case $dstdir in
- /*) pathcomp=/ ;;
- -*) pathcomp=./ ;;
- *) pathcomp= ;;
+ /*) prefix=/ ;;
+ -*) prefix=./ ;;
+ *) prefix= ;;
esac
case $posix_glob in
$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