autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] Fix for AS_MKDIR_P and symbolic links


From: Paul Hilfinger
Subject: [PATCH] Fix for AS_MKDIR_P and symbolic links
Date: Tue, 13 Jan 2004 16:33:40 -0800

On some systems (particularly, Solaris 8), when 'mkdir -p' is given a 
path that references an existing symbolic link to an existing
directory, it fails, giving a non-zero status code.  As a result,
the current definition of AS_MKDIR_P, which begins with

    if $as_mkdir_p; then
       mkdir -p $1
    else
       ...

yields an 'if' whose resulting status code is also non-zero.  Since
this code gets looked at in places, there are obvious problems.  I
suggest re-writing the macro as

    if $as_mkdir_p; then
       test -d $1 || mkdir -p $1
    else
       ...

(see patch below) which should circumvent the problem.

P. Hilfinger

2004-01-13  Paul Hilfinger  <address@hidden>

        * lib/m4sugar/m4sh.m4: When mkdir -p is available, test for 
        existing directory first so that status code is right even on
        systems like Solaris 8, in which mkdir -p gives a non-zero status
        when given a symbolic link to an existing directory.

--- ./lib/m4sugar/m4sh.m4~      Thu Nov  6 00:46:24 2003
+++ ./lib/m4sugar/m4sh.m4       Mon Jan 12 20:44:21 2004
@@ -703,7 +703,7 @@
 m4_define([AS_MKDIR_P],
 [AS_REQUIRE([_$0_PREPARE])dnl
 { if $as_mkdir_p; then
-    mkdir -p $1
+    test -d $1 || mkdir -p $1
   else
     as_dir=$1
     as_dirs=




reply via email to

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