[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism.
From: |
Stefano Lattarini |
Subject: |
[PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism. |
Date: |
Wed, 15 Sep 2010 13:26:50 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Gosh, it has been trickier than I expected!
OK for maint?
Regards,
Stefano
-*-*-
Work around a bug in file-inclusion mechanism of Solaris make.
* automake.in (handle_single_transform): In the name of the
dependency file: collapse multiple slash characters into a single
one.
* tests/subobj11a.test: New test.
* tests/subobj11b.test: Likewise.
* tests/subobj11c.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
* NEWS: Updated.
Report by Stefano Lattarini, fix by Ralf Wildenhues, final patch
and tests by Stefano Lattarini.
---
ChangeLog | 15 ++++++++
NEWS | 4 ++
automake.in | 22 +++++++++++-
tests/Makefile.am | 3 ++
tests/Makefile.in | 3 ++
tests/subobj11a.test | 82 +++++++++++++++++++++++++++++++++++++++++++++++
tests/subobj11b.test | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/subobj11c.test | 53 ++++++++++++++++++++++++++++++
8 files changed, 267 insertions(+), 2 deletions(-)
create mode 100755 tests/subobj11a.test
create mode 100755 tests/subobj11b.test
create mode 100755 tests/subobj11c.test
From c93d17d34273a82ba2f9e54060d126d3a45d4797 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 14 May 2010 21:19:32 +0200
Subject: [PATCH] Work around a bug in file-inclusion mechanism of Solaris make.
* automake.in (handle_single_transform): In the name of the
dependency file: collapse multiple slash characters into a single
one.
* tests/subobj11a.test: New test.
* tests/subobj11b.test: Likewise.
* tests/subobj11c.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
* NEWS: Updated.
Report by Stefano Lattarini, fix by Ralf Wildenhues, final patch
and tests by Stefano Lattarini.
---
ChangeLog | 15 ++++++++
NEWS | 4 ++
automake.in | 22 +++++++++++-
tests/Makefile.am | 3 ++
tests/Makefile.in | 3 ++
tests/subobj11a.test | 82 +++++++++++++++++++++++++++++++++++++++++++++++
tests/subobj11b.test | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/subobj11c.test | 53 ++++++++++++++++++++++++++++++
8 files changed, 267 insertions(+), 2 deletions(-)
create mode 100755 tests/subobj11a.test
create mode 100755 tests/subobj11b.test
create mode 100755 tests/subobj11c.test
diff --git a/ChangeLog b/ChangeLog
index 7b64d55..2cd9759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-15 Ralf Wildenhues <address@hidden>
+ Stefano Lattarini <address@hidden>
+
+ Work around a bug in file-inclusion mechanism of Solaris make.
+ * automake.in (handle_single_transform): In the name of the
+ dependency file: collapse multiple slash characters into a single
+ one.
+ * tests/subobj11a.test: New test.
+ * tests/subobj11b.test: Likewise.
+ * tests/subobj11c.test: Likewise.
+ * tests/Makefile.am (TESTS): Updated.
+ * NEWS: Updated.
+ Report by Stefano Lattarini, fix by Ralf Wildenhues, final patch
+ and tests by Stefano Lattarini.
+
2010-09-13 Ralf Wildenhues <address@hidden>
* HACKING: Hint at old commits with `git describe' output.
diff --git a/NEWS b/NEWS
index 3a0ca06..caa8c41 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,10 @@ Bugs fixed in 1.11.0a:
- The order of Yacc and Lex flags is fixed to be consistent with other
languages: $(AM_YFLAGS) comes before $(YFLAGS), and $(AM_LFLAGS) before
$(LFLAGS), so that the user variables override the developer variables.
+
+ - The code for automatic dependency tracking works around a Solaris
+ make bug triggered by sources containg repeated slashes when the
+ `subdir-objects' was used.
New in 1.11:
diff --git a/automake.in b/automake.in
index fa098bb..dbd7ceb 100755
--- a/automake.in
+++ b/automake.in
@@ -2113,8 +2113,26 @@ sub handle_single_transform ($$$$$%)
my $depfile = $object;
$depfile =~ s/\.([^.]*)$/.P$1/;
$depfile =~ s/\$\(OBJEXT\)$/o/;
- $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
- . basename ($depfile)} = 1;
+ # The following substitution is required to work around a bug
+ # of Solaris make (still present in Solaris 10).
+ # If we have a Makefile containing a file inclusion like this:
+ # include .//foo.mk
+ # Solaris make fails with a message like:
+ # make: ... can't find `/foo.mk': No such file or directory
+ # make: fatal error ... read of include file `/foo.mk' failed
+ # (even if the file `foo.mk' exists).
+ # The error disappear by collapsing the repeated slash `/'
+ # characters into a single one. However, we must be careful
+ # in doing so, since Posix lets implementations treat leading
+ # // specially (see "File System Conventions" in the Autoconf
+ # manual for more info).
+ $depfile =~ m,^(//)[^/],;
+ my $maybe_extra_leading_slash = $1 ? '/' : '';
+ $depfile =~ s,/+,/,g;
+ my $basename = basename ($depfile);
+ (my $dirname = dirname ($depfile)) =~ s,/*$,,; #,# font-lock
+ $dirname = $maybe_extra_leading_slash . $dirname;
+ $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1;
}
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 58103cc..d3a0a71 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -670,6 +670,9 @@ subobj7.test \
subobj8.test \
subobj9.test \
subobj10.test \
+subobj11a.test \
+subobj11b.test \
+subobj11c.test \
subobjname.test \
subpkg.test \
subpkg2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index e967caa..0e54a9f 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -908,6 +908,9 @@ subobj7.test \
subobj8.test \
subobj9.test \
subobj10.test \
+subobj11a.test \
+subobj11b.test \
+subobj11c.test \
subobjname.test \
subpkg.test \
subpkg2.test \
diff --git a/tests/subobj11a.test b/tests/subobj11a.test
new file mode 100755
index 0000000..752d492
--- /dev/null
+++ b/tests/subobj11a.test
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that automake works around a bug of Solaris Make. The bug is the
+# following. If we have a Makefile containg a file inclusion like this:
+# include .//foo.mk
+# Solaris make fails with a message like:
+# make: ... can't find `/foo.mk': No such file or directory
+# make: fatal error ... read of include file `/foo.mk' failed
+# (even if the file `foo.mk' exists). The error disappear by collapsing
+# the repeated slash `/' characters into a single one.
+#
+# See also sister "grepping" test `subobj11b.test', and related test
+# `subobj11c.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+## the `.//' is meant
+foo_SOURCES = .//src/foo.c
+END
+
+mkdir src
+
+cat > src/foo.c << 'END'
+int main(void)
+{
+ return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --enable-dependency-tracking
+
+if test -d src/.deps; then
+ depdir=src/.deps
+elif test -d src/_deps; then
+ depdir=src/_deps
+else
+ echo "$me: depdir not found in src/" >&2
+ Exit 1
+fi
+
+test -f $depdir/foo.Po
+
+echo 'quux:; echo "address@hidden@z" >$@' >> $depdir/foo.Po
+
+$MAKE quux
+$FGREP "address@hidden@z" quux
+
+$MAKE
+
+$MAKE DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' distcheck
+$MAKE DISTCHECK_CONFIGURE_FLAGS='--disable-dependency-tracking' distcheck
+
+:
diff --git a/tests/subobj11b.test b/tests/subobj11b.test
new file mode 100755
index 0000000..1db5fab
--- /dev/null
+++ b/tests/subobj11b.test
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that automake works around a bug of Solaris Make. The bug is the
+# following. If we have a Makefile containg a file inclusion like this:
+# include .//foo.mk
+# Solaris make fails with a message like:
+# make: ... can't find `/foo.mk': No such file or directory
+# make: fatal error ... read of include file `/foo.mk' failed
+# (even if the file `foo.mk' exists). The error disappear by collapsing
+# the repeated slash `/' characters into a single one.
+#
+# See also "semantic" sister test `subobj11a.test', and related test
+# `subobj11c.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+## The `zardoz' sources should activate a code paths in Automake that
+## cannot be sensibly tested by sister test `subobj11a.test'. The other
+## sources provide some sort of stress testing.
+foo_SOURCES = \
+ //server/zardoz0.c \
+ //server//zardoz1.c \
+ //server/path/to/zardoz2.c \
+ //server/another//path///to////zardoz3.c \
+ /foobar0.c \
+ ///foobar1.c \
+ ////foobar2.c \
+ /sub///foobar3.c \
+ ///sub/foobar4.c \
+ .//foobar5.c \
+ .//sub/foobar6.c \
+ ./sub//foobar7.c \
+ .//sub//foobar8.c \
+ sub/sub//sub///sub////foobar9.c
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+# Be lax in the regexp, to account for automake conditionals, the
+# use of @am__include@, and similar stuff.
+grep 'include.*//.*foobar' Makefile.in && Exit 1
+
+# These checks depend on automake internals, but presently this is
+# the only way to test the code path we are interested in.
+# Please update these checks when (and if) the relevant automake
+# internals are changed.
+for x in zardoz0 zardoz1 path/to/zardoz2 another/path/to/zardoz3; do
+ case $x in
+ */*) d=`echo $x | sed 's,[^/]*$,,'`; b=`echo $x | sed 's,^.*/,,'`;;
+ *) d=''; b=$x;;
+ esac
+ # Be a little lax in the regexp, to account for automake conditionals,
+ # quoting, and similar stuff.
+ grep "^[^/]*am__include[^/]*//server/$d\\\$(DEPDIR)/$b\\.[^/]*$" Makefile.in
+done
+
+# Sanity checks.
+for i in 0 1 2 3 4 5 6 7 8 9; do
+ grep "am__include.*/foobar$i\\." Makefile.in
+done
+
+:
diff --git a/tests/subobj11c.test b/tests/subobj11c.test
new file mode 100755
index 0000000..ac9940a
--- /dev/null
+++ b/tests/subobj11c.test
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Automatic dependency tracking with subdir-objects option active:
+# check for a patologic case of slash-collapsing in the name of
+# included makefile fragments (containing dependency info).
+# See also related tests `subobj11a.test' and `subobj11b.test'
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+foo_SOURCES = //zardoz.c
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+#
+# This check depends on automake internals, but presently this is
+# the only way to test the code path we are interested in.
+# Please update these checks when (and if) the relevant automake
+# internals are changed.
+#
+# Be a little lax in the regexp, to account for automake conditionals,
+# quoting, and similar stuff.
+#
+# FIXME: Are we sure this is the most sensible output in our situation?
+#
+grep '^[^/]*am__include[^/]*//\$(DEPDIR)/zardoz\.[^/]*$' Makefile.in
+
+:
--
1.7.1
- Re: [PATCH] Work around a bug in Solaris make's file-inclusion mechanism., Ralf Wildenhues, 2010/09/13
- Re: [PATCH] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/13
- [PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism.,
Stefano Lattarini <=
- Re: [PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism., Ralf Wildenhues, 2010/09/15
- Re: [PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/15
- Re: [PATCH v2] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/22
- [PATCH v3] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/22
- Re: [PATCH v3] Work around a bug in Solaris make's file-inclusion mechanism., Ralf Wildenhues, 2010/09/26
- Re: [PATCH v3] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/26
- [PATCH v3 2/?] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/24
- Re: [PATCH v3 2/?] Work around a bug in Solaris make's file-inclusion mechanism., Ralf Wildenhues, 2010/09/26
- Re: [PATCH v3 2/?] Work around a bug in Solaris make's file-inclusion mechanism., Stefano Lattarini, 2010/09/26
- Re: [PATCH v3 2/?] Work around a bug in Solaris make's file-inclusion mechanism., Ralf Wildenhues, 2010/09/26