From unknown Tue Jun 17 01:44:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15981: regression: 1.14 may use ac_aux_dir before it is defined Resent-From: Peter Hutterer Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Wed, 27 Nov 2013 00:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15981 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: 15981@debbugs.gnu.org Cc: David Herrmann X-Debbugs-Original-To: bug-automake@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.138551311823931 (code B ref -1); Wed, 27 Nov 2013 00:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Nov 2013 00:45:18 +0000 Received: from localhost ([127.0.0.1]:46568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlTFl-0006Dv-UU for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:45:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36954) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlTEa-0006BC-K5 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:44:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlTEM-00039P-JL for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:43:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEM-00039L-G5 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:43:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEG-0006Ri-Bl for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlTEA-0002wJ-DB for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:44 -0500 Received: from leo.clearchain.com ([199.73.29.74]:28365 helo=mail.clearchain.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEA-0002li-70 for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:38 -0500 Received: from leo.clearchain.com (localhost [127.0.0.1]) by mail.clearchain.com (8.14.5/8.14.5) with ESMTP id rAR0fMmW006136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2013 11:11:22 +1030 (CST) (envelope-from peter.hutterer@who-t.net) Received: (from whot@localhost) by leo.clearchain.com (8.14.5/8.14.5/Submit) id rAR0fM8E006135; Wed, 27 Nov 2013 11:11:22 +1030 (CST) (envelope-from peter.hutterer@who-t.net) X-Authentication-Warning: leo.clearchain.com: whot set sender to peter.hutterer@who-t.net using -f Date: Wed, 27 Nov 2013 10:43:42 +1000 From: Peter Hutterer Message-ID: <20131127004342.GA17474@yabbi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (mail.clearchain.com [127.0.0.1]); Wed, 27 Nov 2013 11:11:22 +1030 (CST) X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Tue, 26 Nov 2013 19:45:17 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) automake 1.14 may use $ac_aux_dir before it is defined, leading to error messages such as /bin/sh: /home/david/missing: No such file or directory The configure script runs this: # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` before the definition of ac_aux_dir, so $am_aux_dir is always $HOME, which causes the above error later. Turns out the culprit is, at least in our case, AC_SYSTEM_EXTENSIONS. Simple reproducer: AC_PREREQ([2.62]) AC_INIT([test], [0.0]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([1.11 foreign]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT With automake 1.13.4 this works, 1.14 breaks. Moving the call to AC_USE_SYSTEM_EXTENSIONS below AM_INIT_AUTOMAKE makes it work again. It gets a bit convoluted to find the direct cause but I suspect it's the AC_PROG_CC changes in 34001a987a6de, and it looks like AC_USE_SYSTEM_EXTENSIONS calls that after a few levels of nesting (where I got lost, sorry). In case it matters, above testcase tested with autoconf from git (v2.69-112-gf181785). Bisect range: good: 1.13.4 bad: b7bdb2c3f2fb66a2384123670fb47b83d30c4bf9 Bisected to: commit 34001a987a6defdb70f6f3c17cce9d9c665fe6e8 "compile: use 'compile' script when "-c -o" is used with losing compilers" Cheers, Peter From unknown Tue Jun 17 01:44:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Peter Hutterer Subject: bug#15981: closed ([PATCH] init: ensure $ac_aux_dir is defined before being used) Message-ID: References: <0789d871ecf98b38f39ad6b38badf2283843bdb3.1398164232.git.stefano.lattarini@gmail.com> <20131127004342.GA17474@yabbi> X-Gnu-PR-Message: they-closed 15981 X-Gnu-PR-Package: automake Reply-To: 15981@debbugs.gnu.org Date: Tue, 22 Apr 2014 10:59:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1398164343-20278-1" This is a multi-part message in MIME format... ------------=_1398164343-20278-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15981: regression: 1.14 may use ac_aux_dir before it is defined which was filed against the automake package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15981@debbugs.gnu.org. --=20 15981: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15981 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1398164343-20278-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15981-done) by debbugs.gnu.org; 22 Apr 2014 10:58:07 +0000 Received: from localhost ([127.0.0.1]:54759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcYOs-0005FM-Ex for submit@debbugs.gnu.org; Tue, 22 Apr 2014 06:58:07 -0400 Received: from mail-ee0-f53.google.com ([74.125.83.53]:44665) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WcYOl-0005Er-S8 for 15981-done@debbugs.gnu.org; Tue, 22 Apr 2014 06:58:04 -0400 Received: by mail-ee0-f53.google.com with SMTP id b57so4448409eek.40 for <15981-done@debbugs.gnu.org>; Tue, 22 Apr 2014 03:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=OEQ2kVso7ytU7ddsqjeByQPYJpONUU+1gX+yNk4nkjY=; b=eXMxWjw6TMRq7XbaGQ3oKlEMhmFS3rpYCGZwom5vKymHBa7xMCgVN55nC80IZzIMmc Z+AMSpX7cKHKaar+tVaLSSnHhhDAyVO17XW4BVEAV4SronZN/LJ/n25zCzS5hO2br55b 5H+ul0SeHM3rIeWtlegLT/Mkj77tVWSIOkLM0EQPwgvxhP89cR8Rtj9GICds8Q7Dpu97 Mi3KBWEKp0hokRMi0kWqudW/LfkBHIkc7A+qLj5hX1qb+Fn3CFAWlAUS+oNvN9sp9Qtb ApwInBUm8H8bDfcgAO18QxbdzN7MixdGm6Km4xE/MKVB00r24ONgt0QB86A92pvcrM8Y eDoA== X-Received: by 10.14.215.9 with SMTP id d9mr12362431eep.64.1398164278674; Tue, 22 Apr 2014 03:57:58 -0700 (PDT) Received: from localhost.localdomain (host66-50-dynamic.58-82-r.retail.telecomitalia.it. [82.58.50.66]) by mx.google.com with ESMTPSA id y7sm111972032eev.5.2014.04.22.03.57.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Apr 2014 03:57:57 -0700 (PDT) From: Stefano Lattarini To: automake-patches@gnu.org Subject: [PATCH] init: ensure $ac_aux_dir is defined before being used Date: Tue, 22 Apr 2014 11:57:47 +0100 Message-Id: <0789d871ecf98b38f39ad6b38badf2283843bdb3.1398164232.git.stefano.lattarini@gmail.com> X-Mailer: git-send-email 1.9.1 X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 15981-done Cc: peter.hutterer@who-t.net, 15981-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Since we use $ac_aux_dir to define $am_aux_dir, we need to ensure the former has been initialized before we try to define the latter, otherwise the definition: am_aux_dir=`cd $ac_aux_dir && pwd` will set $am_aux_dir to $HOME, causing weird and unexpected behaviours. This change fixes automake bug#15981. * m4/auxdir.m4: AC_REQUIRE expansion of 'AC_CONFIG_AUX_DIR_DEFAULT'. Fix redundant comment and AC_PREREQ, add extra quoting around '$ac_aux_dir'. * t/auxdir-pr15981.sh: New test. * t/auxdir-cc-pr15981.sh: Likewise. * t/list-of-tests.mk (handwritten_TESTS): Add them. * THANKS: Update. * bin/automake.in: Fix a harmless typo in comments, that I happened to notice while writing this patch. Signed-off-by: Stefano Lattarini --- THANKS | 1 + bin/automake.in | 2 +- m4/auxdir.m4 | 7 +++---- t/auxdir-cc-pr15981.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ t/auxdir-pr15981.sh | 39 ++++++++++++++++++++++++++++++++++ t/list-of-tests.mk | 2 ++ 6 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 t/auxdir-cc-pr15981.sh create mode 100644 t/auxdir-pr15981.sh diff --git a/THANKS b/THANKS index 550b565..eef67c3 100644 --- a/THANKS +++ b/THANKS @@ -317,6 +317,7 @@ Per Oyvind Hvidsten poeh@enter.vg Peter Breitenlohner peb@mppmu.mpg.de Peter Eisentraut peter_e@gmx.net Peter Gavin pgavin@debaser.kicks-ass.org +Peter Hutterer peter.hutterer@who-t.net Peter Johansson trojkan@gmail.com Peter Mattis petm@scam.XCF.Berkeley.EDU Peter Muir iyhi@yahoo.com diff --git a/bin/automake.in b/bin/automake.in index 996a9de..f9cc611 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -313,7 +313,7 @@ my $seen_ar = 0; # Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument. my %required_aux_file = (); -# Where AM_INIT_AUTOMAKE is called; +# Where AM_INIT_AUTOMAKE is called. my $seen_init_automake = 0; # TRUE if we've seen AM_AUTOMAKE_VERSION. diff --git a/m4/auxdir.m4 b/m4/auxdir.m4 index 1f8614d..93fc225 100644 --- a/m4/auxdir.m4 +++ b/m4/auxdir.m4 @@ -45,8 +45,7 @@ # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) diff --git a/t/auxdir-cc-pr15981.sh b/t/auxdir-cc-pr15981.sh new file mode 100644 index 0000000..74157cb --- /dev/null +++ b/t/auxdir-cc-pr15981.sh @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2014 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 . + +# Test automake bug#15981: automake 1.14 may use $ac_aux_dir +# before it is defined, leading to error messages such as: +# "/bin/sh: /home/david/missing: No such file or directory" + +required=cc +. test-init.sh + +cat > configure.ac < foo.c + +cat > Makefile.am <<'END' +bin_PROGRAMS = foo + +# Without quotes around '--help' and with an empty $(MISSING), make might +# strip the trailing '--', call Bash's 'help' builtin, and have this test +# succeed spuriously. Yes, that has happened in practice :-( +test: + $(MISSING) '--help' +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure 2>stderr || { cat stderr >&2; exit 1; } +cat stderr >&2 +$FGREP "missing" stderr && exit 1 + +$MAKE all +$MAKE test + +: diff --git a/t/auxdir-pr15981.sh b/t/auxdir-pr15981.sh new file mode 100644 index 0000000..f09d551 --- /dev/null +++ b/t/auxdir-pr15981.sh @@ -0,0 +1,39 @@ +#! /bin/sh +# Copyright (C) 2014 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 . + +# AM_AUX_DIR_EXPAND should ensure $ac_aux_dir is properly initialized. +# Issue revealed by related automake bug#15981. + +. test-init.sh + +cat > configure.ac <<'END' +AC_INIT([test], [0.0]) +AM_AUX_DIR_EXPAND +printf '%s\n' "ac_aux_dir: '$ac_aux_dir'" +printf '%s\n' "am_aux_dir: '$am_aux_dir'" +test "$ac_aux_dir" = . || AS_EXIT([1]) +test "$am_aux_dir" = "`pwd`" || AS_EXIT([1]) +AS_EXIT([0]) +END + +$ACLOCAL +$AUTOCONF + +test -f install-sh # sanity check + +./configure + +: diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 6b2eebe..e6ee856 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -116,6 +116,8 @@ t/aclocal-scan-configure-ac-pr319.sh \ t/aclocal-serial.sh \ t/aclocal-underquoted-defun.sh \ t/aclocal-verbose-install.sh \ +t/auxdir-pr15981.sh \ +t/auxdir-cc-pr15981.sh \ t/ac-output-old.tap \ t/acsilent.sh \ t/acsubst.sh \ -- 1.9.1 ------------=_1398164343-20278-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Nov 2013 00:45:18 +0000 Received: from localhost ([127.0.0.1]:46568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlTFl-0006Dv-UU for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:45:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36954) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlTEa-0006BC-K5 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:44:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlTEM-00039P-JL for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:43:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEM-00039L-G5 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 19:43:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEG-0006Ri-Bl for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlTEA-0002wJ-DB for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:44 -0500 Received: from leo.clearchain.com ([199.73.29.74]:28365 helo=mail.clearchain.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlTEA-0002li-70 for bug-automake@gnu.org; Tue, 26 Nov 2013 19:43:38 -0500 Received: from leo.clearchain.com (localhost [127.0.0.1]) by mail.clearchain.com (8.14.5/8.14.5) with ESMTP id rAR0fMmW006136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2013 11:11:22 +1030 (CST) (envelope-from peter.hutterer@who-t.net) Received: (from whot@localhost) by leo.clearchain.com (8.14.5/8.14.5/Submit) id rAR0fM8E006135; Wed, 27 Nov 2013 11:11:22 +1030 (CST) (envelope-from peter.hutterer@who-t.net) X-Authentication-Warning: leo.clearchain.com: whot set sender to peter.hutterer@who-t.net using -f Date: Wed, 27 Nov 2013 10:43:42 +1000 From: Peter Hutterer To: bug-automake@gnu.org Subject: regression: 1.14 may use ac_aux_dir before it is defined Message-ID: <20131127004342.GA17474@yabbi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (mail.clearchain.com [127.0.0.1]); Wed, 27 Nov 2013 11:11:22 +1030 (CST) X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 26 Nov 2013 19:45:17 -0500 Cc: David Herrmann X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) automake 1.14 may use $ac_aux_dir before it is defined, leading to error messages such as /bin/sh: /home/david/missing: No such file or directory The configure script runs this: # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` before the definition of ac_aux_dir, so $am_aux_dir is always $HOME, which causes the above error later. Turns out the culprit is, at least in our case, AC_SYSTEM_EXTENSIONS. Simple reproducer: AC_PREREQ([2.62]) AC_INIT([test], [0.0]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([1.11 foreign]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT With automake 1.13.4 this works, 1.14 breaks. Moving the call to AC_USE_SYSTEM_EXTENSIONS below AM_INIT_AUTOMAKE makes it work again. It gets a bit convoluted to find the direct cause but I suspect it's the AC_PROG_CC changes in 34001a987a6de, and it looks like AC_USE_SYSTEM_EXTENSIONS calls that after a few levels of nesting (where I got lost, sorry). In case it matters, above testcase tested with autoconf from git (v2.69-112-gf181785). Bisect range: good: 1.13.4 bad: b7bdb2c3f2fb66a2384123670fb47b83d30c4bf9 Bisected to: commit 34001a987a6defdb70f6f3c17cce9d9c665fe6e8 "compile: use 'compile' script when "-c -o" is used with losing compilers" Cheers, Peter ------------=_1398164343-20278-1--