From 5a8604fcc62d3b073f6772284071fccd49ab8ec3 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 22 Oct 2004 06:45:08 +0000 Subject: [PATCH] =?utf8?q?*=20lib/install-sh:=20Fix=20the=20dirname=20emul?= =?utf8?q?ation=20to=20ignore=20trailing=20slashes,=20i.e.,=20the=20direna?= =?utf8?q?me=20of=20`a/b/'=20is=20`a',=20not=20`a/b/'.=20=20This=20caused?= =?utf8?q?=20`install-sh=20a/b/'=20to=20fail.=20*=20tests/instsh2.test:=20?= =?utf8?q?Augment.=20Report=20from=20=D0=9F=D1=83=D1=85=D0=B0=D0=BB=D1=8C?= =?utf8?q?=D1=81=D0=BA=D0=B8=D0=B9=20=D0=AE=D1=80=D0=B8=D0=B9=20=D0=90?= =?utf8?q?=D0=BD=D0=B4=D1=80=D0=B5=D0=B5=D0=B2=D0=B8=D1=87.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ChangeLog | 8 ++++++++ lib/install-sh | 7 ++++--- tests/instsh2.test | 15 +++++++++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) 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' -- 2.47.2