autoconf
[Top][All Lists]
Advanced

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

Re: mkinstalldirs


From: Paul Eggert
Subject: Re: mkinstalldirs
Date: Wed, 26 Sep 2001 15:33:34 -0700 (PDT)

> From: John Poltorak <address@hidden>
> Date: Wed, 26 Sep 2001 21:50:19 +0100
> 
> Where is the definitive version of mkinstalldirs?

I'd say that it's the one in autoconf.

> I would like some changes to mkinstalldirs so that it will work with drive 
> letters so that I can use it on OS/2 without the need to have an OS/2 
> specific version.

Does "mkdir -p" work on OS/2?  If so, here's a simple patch to
have things work the way you like.  If not, it's a longer story, but
let's not go down that road unless we have to.

Something like this patch should be installed regardless of OS/2
issues, as the existing mkinstalldirs mishandles path names with funky
characters, even on POSIX hosts.


2001-09-26  Paul Eggert  <address@hidden>

        * config/mkinstalldirs: Use "mkdir -p" if it works, as that
        fixes bugs when making file names with unusual characters.
        Quote chmod arg "$dirmode", in case it contains white space.

--- autoconf-fix0/config/mkinstalldirs  Tue May 22 07:43:50 2001
+++ autoconf-fix1/config/mkinstalldirs  Wed Sep 26 15:28:07 2001
@@ -28,6 +28,23 @@ while test $# -gt 0 ; do
    esac
 done
 
+case $# in
+0) exit 0 ;;
+esac
+
+case $dirmode in
+'')
+  if mkdir -p -- . 2>/dev/null; then
+    echo "mkdir -p -- $*"
+    exec mkdir -p -- "$@"
+  fi ;;
+*)
+  if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+    echo "mkdir -m $dirmode -p -- $*"
+    exec mkdir -m "$dirmode" -p -- "$@"
+  fi ;;
+esac
+
 for file
 do
    set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
@@ -53,7 +70,7 @@ do
             echo "chmod $dirmode $pathcomp"
 
             lasterr=""
-            chmod $dirmode "$pathcomp" || lasterr=$?
+            chmod "$dirmode" "$pathcomp" || lasterr=$?
 
             if test ! -z "$lasterr"; then
               errstatus=$lasterr



reply via email to

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