automake-patches
[Top][All Lists]
Advanced

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

Re: mkinstalldirs: directory names with embedded whitespace or newlines


From: Alexandre Duret-Lutz
Subject: Re: mkinstalldirs: directory names with embedded whitespace or newlines
Date: Tue, 31 May 2005 23:50:44 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

>>> "Noah" == Noah Friedman <address@hidden> writes:

 Noah> I received a bug report about a KDE application that was
 Noah> using an old version of mkinstalldirs and failed when one
 Noah> of the directories had an embedded space in the name.
 Noah> The following attachment is a diff against the version in
 Noah> Automake 1.9 to handle this case.  (It's the "last
 Noah> resort" case where mkdir -p doesn't work.)

Thanks for reporting this.  
Your change look very cryptic to me; can you comment it?

Wouldn't this bug be fixed simply using IFS=/ as follows?

Index: lib/mkinstalldirs
===================================================================
RCS file: /cvs/automake/automake/lib/mkinstalldirs,v
retrieving revision 1.18
diff -u -r1.18 mkinstalldirs
--- lib/mkinstalldirs   14 May 2005 20:28:50 -0000      1.18
+++ lib/mkinstalldirs   31 May 2005 21:43:33 -0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
 
-scriptversion=2005-05-14.22
+scriptversion=2005-05-31.23
 
 # Original author: Noah Friedman <address@hidden>
 # Created: 1993-05-16
@@ -103,12 +103,20 @@
 
 for file
 do
-  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  case $file in
+    /*) pathcomp=/ ;;
+    *)  pathcomp= ;;
+  esac
+  oIFS=$IFS
+  IFS=/
+  set fnord $file
   shift
+  IFS=$oIFS
 
-  pathcomp=
   for d
   do
+    test -z "$d" && continue
+
     pathcomp="$pathcomp$d"
     case $pathcomp in
       -*) pathcomp=./$pathcomp ;;
-- 
Alexandre Duret-Lutz





reply via email to

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