Re: AC_PROG_INSTALL and AC_PROG_MKDIR_P fallbacks

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

 



On 08/08/14 01:00, Peter Johansson wrote:
> I think you're welcome to send in a patch given the response I got from Paul
> Eggert and Eric Blake when I reported similar thing last year
> 
> http://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00012.html

Thanks, from that thread I can also see that the fix needs to be in the program
macros because then nothing's lost if the problem with funny path characters
applies, i.e. I'm too timid to modify ac_install_sh but rather mangle the value
of MKDIR_P if and only if it is a relative path.

Please see my attached patch (tested on FreeBSD 10) for AC_PROG_MKDIR_P.

A patch for AC_PROG_INSTALL would have to be identical but I don't have a system
to test. Our AIX machines have a working install program and the same is true
for FreeBSD. If anyone has a suggestion for a platform to test this on
(preferably available for install to a VM) I'd give it a go.

Regards, Thomas

From e61ebcd649a0260c9a143a5ddebfb0199581ee45 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@xxxxxxx>
Date: Fri, 8 Aug 2014 13:18:56 +0200
Subject: [PATCH] Fix relative path in ac_install_sh for MKDIR_P.

---
 lib/autoconf/programs.m4 |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 32f737a..0f214bf 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -687,7 +687,17 @@ if test -z "$MKDIR_P"; then
     # value for MKDIR_P within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the value is a relative name.
-    MKDIR_P="$ac_install_sh -d"
+    # 1. extract (relative) path of install script from ac_install_sh
+    MKDIR_P=`echo "$ac_install_sh" | sed 's:\(.*\)/.*:\1:'`
+    AS_CASE(["$MKDIR_P"],
+      # 2. leave as-is if no path component or already absolute ...
+      ["" | [\\/]* | ?:[\\/]*],[],
+      # ... or convert to absolute if relative
+      [MKDIR_P=`cd "$MKDIR_P" && pwd`
+       test -d "$MKDIR_P" ||
+         AC_MSG_FAILURE([Cannot derive absolute path from relative of path of "$ac_install_sh"])
+       ])
+    MKDIR_P="$MKDIR_P"`echo "$ac_install_sh" | sed 's:.*\(/.*\):\1:'`" -d"
   fi
 fi
 dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST,
-- 
1.7.10.4

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux