Subject: Re: bug#11232: automake-1.11.4 regression

From: "Dmitry V. Levin" <[email-masked]>
Date: Fri, 13 Apr 2012 02:22:10 +0400

On Fri, Apr 13, 2012 at 02:04:13AM +0400, Dmitry V. Levin wrote:
> The patch containing the fix with test case will follow shortly.

>From 8810b494a6fff57e7299cee8375ae43c35a82921 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <[email-masked]>
Date: Thu, 12 Apr 2012 16:24:23 +0000
Subject: [PATCH] install: fix the case then an install directory is a shell command

Fixes automake bug#11232.

GNU automake used to support shell commands in installation directories,
but it was inadvertently broken by commit v1.11-759-g368f1c4 where shell
quoting of generated MKDIR_P command was changed from double to single
quotes in 3 places, while some 21 other places still use double quotes
for generated MKDIR_P commands.

* lib/am/data.am: Use double quotes for generated "mkdir -p" commands.
* lib/am/libs.am: Likewise.
* lib/am/ltlib.am: Likewise.
* tests/install-pr11232.test: New test.
* tests/list-of-tests.mk (handwritten_TESTS): Add it.

Signed-off-by: Dmitry V. Levin <[email-masked]>
---
 lib/am/data.am             |    2 +-
 lib/am/libs.am             |    2 +-
 lib/am/ltlib.am            |    2 +-
 tests/install-pr11232.test |   43 +++++++++++++++++++++++++++++++++++++++++++
 tests/list-of-tests.mk     |    1 +
 5 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100755 tests/install-pr11232.test

diff --git a/lib/am/data.am b/lib/am/data.am
index 98a38a8..b8b6588 100644
--- a/lib/am/data.am
+++ b/lib/am/data.am
@@ -33,7 +33,7 @@ if %?BASE%
 	@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
 	if test -n "$$list"; then \
 	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
-	  $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
+	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
 	fi; \
 	for p in $$list; do \
 ## A file can be in the source directory or the build directory.
diff --git a/lib/am/libs.am b/lib/am/libs.am
index 4006bd0..d1f63ae 100644
--- a/lib/am/libs.am
+++ b/lib/am/libs.am
@@ -47,7 +47,7 @@ else !%?BASE%
 	@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
 	if test -n "$$list"; then \
 	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
-	  $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
+	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
 	fi; \
 	$(am__nobase_list) | while read dir files; do \
 	  xfiles=; for p in $$files; do \
diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am
index 65210c1..62ee1d2 100644
--- a/lib/am/ltlib.am
+++ b/lib/am/ltlib.am
@@ -38,7 +38,7 @@ if %?BASE%
 	done; \
 	test -z "$$list2" || { \
 	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
-	  $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
+	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
 ## Note that we explicitly set the libtool mode.  This avoids any lossage
 ## if the program doesn't have a name that libtool expects.
 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
diff --git a/tests/install-pr11232.test b/tests/install-pr11232.test
new file mode 100755
index 0000000..0c4ba22
--- /dev/null
+++ b/tests/install-pr11232.test
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Ensure install works when an install directory is a shell command.
+# See automake bug#11232.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+docdir = `echo /sub/doc`
+doc_DATA = text
+END
+
+echo text > text
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE install DESTDIR="`pwd`/dest"
+test -f dest/sub/doc/text || { find dest; Exit 1; }
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index c344171..bc3da45 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -470,6 +470,7 @@ insh2.test \
 install2.test \
 installdir.test \
 install-info-dir.test \
+install-pr11232.test \
 instsh.test \
 instsh2.test \
 instsh3.test \

-- 
ldv