Subject: bug#15376: install-sh -t accepts arguments that are not a directory

From: Tobias Hansen <[email-masked]>
Date: Sat, 14 Sep 2013 01:06:25 +0200

Version: 1.14
Tags: patch

Hi automake maintainers,

the -t parameter of install-sh is supposed to accept a target directory.
If it is given a file or a name of a non-existent file/directory, the
source is copied into this file. For example, if I have a file foo and do

install-sh -t foo2 foo

I will have the two files foo and foo2. install-sh should abort whenever
the argument of the -t option is not a directory, just like install
does. Attached is a patch that fixes the issue.

Best regards,
Tobias Hansen
diff -uri a/install-sh b/install-sh
--- a/install-sh	2013-09-14 01:04:27.285245115 +0200
+++ b/install-sh	2013-09-14 01:04:34.917244870 +0200
@@ -160,6 +160,10 @@
 	case $dst_arg in
 	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
 	esac
+	if test ! -d $dst_arg; then
+	  echo "$0: $dst_arg is not a directory." >&2
+	  exit 1
+	fi
 	shift;;
 
     -T) no_target_directory=true;;