automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: protect names starting with `-' in install-sh.


From: Alexandre Duret-Lutz
Subject: FYI: protect names starting with `-' in install-sh.
Date: Wed, 24 Sep 2003 23:57:16 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

I'm installing this.  This protection was in mkinstalldirs, so
better put it in install-sh if we want to use `install-sh -d' 
instead of `mkinstalldirs' as discussed some months ago.

2003-09-24  Alexandre Duret-Lutz  <address@hidden>

        * lib/install-sh (src, dst): Protect names starting with `-',
        as in mkinstalldirs.

Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.12
diff -u -r1.12 install-sh
--- lib/install-sh      14 Jun 2003 05:04:52 -0000      1.12
+++ lib/install-sh      24 Sep 2003 21:56:06 -0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2003-06-13.21
+scriptversion=2003-09-24.23
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -151,6 +151,11 @@
   exit 1
 fi
 
+# Protect names starting with `-'.
+case $src in
+  -*) src=./$src ;;
+esac
+
 if test -n "$dir_arg"; then
   dst=$src
   src=
@@ -175,6 +180,11 @@
     exit 1
   fi
 
+  # Protect names starting with `-'.
+  case $dst in
+    -*) dst=./$dst ;;
+  esac
+
   # If destination is a directory, append the input filename; won't work
   # if double slashes aren't ignored.
   if test -d "$dst"; then
@@ -182,11 +192,10 @@
   fi
 fi
 
-## this sed command emulates the dirname command
+# This sed command emulates the dirname command.
 dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
 # Make sure that the destination directory exists.
-# (this part is taken from Noah Friedman's mkinstalldirs script.)
 
 # Skip lots of stat calls in the usual case.
 if test ! -d "$dstdir"; then
-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]