summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-12-26 00:07:27 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-12-26 00:07:27 +0100
commit222337e60bfc87456773a4c7cbbbd3192fde956d (patch)
tree4bef40969d4f02c785f08673e7558a3f5c6111e5 /t
parent6863925ddd92c8f4b44556a2bb32d958d00325ff (diff)
downloadautomake-222337e60bfc87456773a4c7cbbbd3192fde956d.tar.gz
install-sh: be stricter in catching invalid usages
Such usages (which are rejected by GNU install as well) are: - options -d and -t used together; - argument passed to option -t must be a directory; - if there are two or more SOURCEFILE arguments, the DESTINATION argument must be a directory. Note that we still allow the use of options -d and -T together, by making -d take the precedence; this is for compatibility with GNU install. This change fixes, among other things, automake bug#15376. * lib/install-sh: Adjust. * t/install-sh-unittests.sh: Enhance. * NEWS: Update. * THANKS: Add reporter of bug#15376. Helped-by: Tobias Hansen <thansen@debian.org> Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't')
-rw-r--r--t/install-sh-unittests.sh54
1 files changed, 37 insertions, 17 deletions
diff --git a/t/install-sh-unittests.sh b/t/install-sh-unittests.sh
index 8a60d7435..1b85c9ce3 100644
--- a/t/install-sh-unittests.sh
+++ b/t/install-sh-unittests.sh
@@ -25,26 +25,46 @@ get_shell_script install-sh
./install-sh && exit 1
./install-sh -m 644 dest && exit 1
-# Directories.
+# Incorrect usages.
+: > bar
+: > baz
+: > qux
+./install-sh -d -t foo && exit 1
+./install-sh -d -t foo bar && exit 1
+./install-sh -t foo bar && exit 1
+./install-sh bar baz foo && exit 1
+mkdir foo
+./install-sh -d -t foo && exit 1
+./install-sh -d -t foo bar && exit 1
+rmdir foo
+rm -f bar baz qux
-# It should be OK to create no directory. We sometimes need
-# this when directory are conditionally defined.
-./install-sh -d
-# One directory.
-./install-sh -d d0
-test -d d0
-# Multiple directories (for make installdirs).
-./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
+# Directories.
+for opts in '-d' '-d -T' '-T -d' '-d -T -d' '-T -d -T -d -T'; do
+ # It should be OK to create no directory. We sometimes need
+ # this when directory are conditionally defined.
+ ./install-sh $opts
+ # One directory.
+ ./install-sh $opts d0
+ test -d d0
+ # Multiple directories (for make installdirs).
+ ./install-sh $opts d1 d2 d3 d4
+ test -d d1
+ test -d d2
+ test -d d3
+ test -d d4
+ rmdir d[0-9]
+ # Subdirectories.
+ ./install-sh $opts p1/p2/p3 p4//p5//p6//
+ test -d p1/p2/p3
+ test -d p4/p5/p6
+ rmdir p[0-9]/p[0-9]/p[0-9]
+ rmdir p[0-9]/p[0-9]
+ rmdir p[0-9]
+done
# Files.
+mkdir d0 d1 d2 d3 d4
: > x
./install-sh -c -m 644 x y
test -f x