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: Stepan Kasal
Subject: Re: mkinstalldirs: directory names with embedded whitespace or newlines
Date: Wed, 29 Jun 2005 12:09:12 +0200
User-agent: Mutt/1.4.1i

Hello,
  I noticed this older post today:

On Tue, May 31, 2005 at 11:50:44PM +0200, Alexandre Duret-Lutz wrote:
>  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.
...
> Wouldn't this bug be fixed simply using IFS=/ as follows?

I think the patch has one minor problem: test -z "$d" is not portable.
See "test (strings)" section in
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_122.html
(node Limitations of Shell Builtins in the Autoconf manual).

Modified version of the patch is attached below.

Are there any reasons why this shouldn't be commited?

Have a nice day,
        Stepan


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 "x$d" = x && continue
+
     pathcomp="$pathcomp$d"
     case $pathcomp in
       -*) pathcomp=./$pathcomp ;;




reply via email to

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