From: Alexandre Duret-Lutz Date: Fri, 22 Oct 2004 06:45:08 +0000 (+0000) Subject: * lib/install-sh: Fix the dirname emulation to ignore trailing X-Git-Tag: Release-1-9b~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a8604fcc62d3b073f6772284071fccd49ab8ec3;p=thirdparty%2Fautomake.git * 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 Пухальский Юрий Андреевич. --- diff --git a/ChangeLog b/ChangeLog index d9fea1ad0..35a0bb0a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-10-22 Alexandre Duret-Lutz + + * 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 * automake.in (get_object_extension): The extension to use is know diff --git a/lib/install-sh b/lib/install-sh index dd97db7aa..0b65ee871 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -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= diff --git a/tests/instsh2.test b/tests/instsh2.test index 99c661c65..cc96c1bda 100755 --- a/tests/instsh2.test +++ b/tests/instsh2.test @@ -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'