Hello Alexandre,

On Tue, Jul 19, 2005 at 10:08:45PM +0200, Alexandre Duret-Lutz wrote:
> I'm reluctant to chop $destdir using sed in a loop, [...]

I think there is a possibility to call the sed only once, before the set.
Please have a look at the attached patch.
I have made some experiments on my cmdline before writing it, but I
haven't tested the patch, sorry.

What would you think about it?

A note: I think that the \\\$ can be replaced by mere $
The reason is that "$," is not expanded, as comma is not valid shell
variable name.  Can we rely on this feature?

Have a nice day,
        Stepan
2005-07-20  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/install-sh: Use sed and eval instead of IFS=/, to avoid word
        splitting.

Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.25
diff -u -r1.25 install-sh
--- lib/install-sh      9 Jul 2005 10:21:12 -0000       1.25
+++ lib/install-sh      20 Jul 2005 08:31:05 -0000
@@ -224,11 +224,10 @@
       -*) pathcomp=./ ;;
       *)  pathcomp= ;;
     esac
-    oIFS=$IFS
-    IFS=/
-    set fnord $dstdir
+    # We cannot use IFS=/ because wildcards are expanded after word splitting.
+    d=`echo "$dstdir"|sed "s,','\\\\\\\\'',g;s,/,' ',g;s,^,',;s,\\\$,',"`
+    eval set fnord "$d"
     shift
-    IFS=$oIFS
 
     for d
     do

Reply via email to