]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* lib/install-sh: Fix the dirname emulation to ignore trailing
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 22 Oct 2004 06:45:08 +0000 (06:45 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 22 Oct 2004 06:45:08 +0000 (06:45 +0000)
slashes, i.e., the direname of `a/b/' is `a', not `a/b/'.  This
caused `install-sh a/b/' to fail.
* tests/instsh2.test: Augment.
Report from Пухальский Юрий Андреевич.

ChangeLog
lib/install-sh
tests/instsh2.test

index d9fea1ad08d995e82d6aa575aa2bf01c8353e673..35a0bb0a747e9662290d700cc64a166b9d74c30d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-22  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * lib/install-sh: Fix the dirname emulation to ignore trailing
+       slashes, i.e., the direname of `a/b/' is `a', not `a/b/'.  This
+       caused `install-sh a/b/' to fail.
+       * tests/instsh2.test: Augment.
+       Report from Пухальский Юрий Андреевич.
+
 2004-10-21  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * automake.in (get_object_extension): The extension to use is know
index dd97db7aa1cae9655149aad9d21c6cf42476c0da..0b65ee871d33c7ab1e6ec36b86dda87e0d85c6ee 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2004-09-10.20
+scriptversion=2004-10-22.00
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -213,7 +213,7 @@ do
   fi
 
   # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
 
   # Make sure that the destination directory exists.
 
@@ -226,7 +226,8 @@ do
     oIFS=$IFS
     # Some sh's can't handle IFS=/ for some reason.
     IFS='%'
-    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
     IFS=$oIFS
 
     pathcomp=
index 99c661c659b53edc7ea61a350ba35b9c935e3884..cc96c1bdab8683e08d1798e84a5fbaec3e05d1ac 100755 (executable)
@@ -37,10 +37,15 @@ set -e
 ./install-sh -d d0
 test -d d0
 # Multiple directories (for make installdirs).
-./install-sh -d d1 d2 d3
+./install-sh -d d1 d2 d3 d4
 test -d d1
 test -d d2
 test -d d3
+test -d d4
+# Subdirectories
+./install-sh -d p1/p2/p3 p4//p5//p6//
+test -d p1/p2/p3
+test -d p4/p5/p6
 
 # Files.
 : > x
@@ -56,7 +61,7 @@ test -f x
 test -f z
 test -f d1/x
 test -f d1/z
-./install-sh -m 644 x z d2
+./install-sh -m 644 x z d2//
 test -f x
 test -f z
 test -f d2/x
@@ -66,10 +71,16 @@ test -f x
 test -f z
 test -f d3/x
 test -f d3/z
+./install-sh -t d4// -m 644 x z
+test -f x
+test -f z
+test -f d4/x
+test -f d4/z
 ./install-sh -T x d3/y
 test -f x
 test -f d3/y
 ./install-sh -T x d3 && exit 1
+./install-sh -T x d4// && exit 1
 
 # Ensure that install-sh works with names that include spaces
 touch 'a  b'