On Wednesday 22 September 2010, Stefano Lattarini wrote: > On Wednesday 15 September 2010, Ralf Wildenhues wrote: > > * Stefano Lattarini wrote on Wed, Sep 15, 2010 at 01:26:50PM CEST: > > > OK for maint? > > No, it's not. There's still a bug (causing regression) due to some > dark corners in Perl handling of `$1' across statements (ouch!). > The new bug triggers only when libtool objects are involved, so I > didn't notice it right away (I've noticed it now because I was > re-running the full testsuite). I will post an updated patch > soonish, with enahnced test cases to guard against this > regression. Done in the attache patch. The testsuite now shows no regression on Debian and Solaris (with Solaris /bin/sh and Solaris make).
> BTW, I prefer to keep the refactoring of new code into a new > function for a follow-up patch (not a squash-in) To follow soon (probably tomorrow). Regards, Stefano
From 8c256baa74345200657c0e2614edc0c86fd8133f Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> 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/depcomp8a.test: Likewise. * tests/depcomp8b.test: Likewise. * tests/Makefile.am (TESTS): Updated. * NEWS: Updated. Report by Stefano Lattarini, quick fix by Ralf Wildenhues, final patch and tests by Stefano Lattarini. --- ChangeLog | 17 ++++++++++ NEWS | 4 ++ automake.in | 26 ++++++++++---- tests/Makefile.am | 5 +++ tests/Makefile.in | 5 +++ tests/depcomp8a.test | 79 +++++++++++++++++++++++++++++++++++++++++++++ tests/depcomp8b.test | 73 ++++++++++++++++++++++++++++++++++++++++++ tests/subobj11a.test | 82 +++++++++++++++++++++++++++++++++++++++++++++++ tests/subobj11b.test | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/subobj11c.test | 53 ++++++++++++++++++++++++++++++ 10 files changed, 423 insertions(+), 8 deletions(-) create mode 100755 tests/depcomp8a.test create mode 100755 tests/depcomp8b.test 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..dbb7b82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2010-09-23 Ralf Wildenhues <ralf.wildenh...@gmx.de> + Stefano Lattarini <stefano.lattar...@gmail.com> + + 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/depcomp8a.test: Likewise. + * tests/depcomp8b.test: Likewise. + * tests/Makefile.am (TESTS): Updated. + * NEWS: Updated. + Report by Stefano Lattarini, quick fix by Ralf Wildenhues, final + patch and tests by Stefano Lattarini. + 2010-09-13 Ralf Wildenhues <ralf.wildenh...@gmx.de> * 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..ab63811 100755 --- a/automake.in +++ b/automake.in @@ -2108,14 +2108,24 @@ sub handle_single_transform ($$$$$%) # Transform .o or $o file into .P file (for automatic # dependency code). - if ($lang && $lang->autodep ne 'no') - { - my $depfile = $object; - $depfile =~ s/\.([^.]*)$/.P$1/; - $depfile =~ s/\$\(OBJEXT\)$/o/; - $dep_files{dirname ($depfile) . '/$(DEPDIR)/' - . basename ($depfile)} = 1; - } + # Properly flatten multiple adjacent slashes, as Solaris 10 make + # might fail over them in an include statement. + # Leading double slashes may be special, as per Posix, so deal + # with them carefully. + if ($lang && $lang->autodep ne 'no') + { + my $depfile = $object; + $depfile =~ s/\.([^.]*)$/.P$1/; + $depfile =~ s/\$\(OBJEXT\)$/o/; + my $maybe_extra_leading_slash = ''; + $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],; + $depfile =~ s,/+,/,g; + my $basename = basename ($depfile); + # This might make $dirname empty, but we account for that below. + (my $dirname = dirname ($depfile)) =~ s/\/*$//; + $dirname = $maybe_extra_leading_slash . $dirname; + $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1; + } } return @result; diff --git a/tests/Makefile.am b/tests/Makefile.am index 58103cc..775fe2a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -261,6 +261,8 @@ depcomp4.test \ depcomp5.test \ depcomp6.test \ depcomp7.test \ +depcomp8a.test \ +depcomp8b.test \ depdist.test \ depend.test \ depend2.test \ @@ -670,6 +672,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..ec56fb5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -499,6 +499,8 @@ depcomp4.test \ depcomp5.test \ depcomp6.test \ depcomp7.test \ +depcomp8a.test \ +depcomp8b.test \ depdist.test \ depend.test \ depend2.test \ @@ -908,6 +910,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/depcomp8a.test b/tests/depcomp8a.test new file mode 100755 index 0000000..7d2fe05 --- /dev/null +++ b/tests/depcomp8a.test @@ -0,0 +1,79 @@ +#! /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 for regressions in computation of names of .Po files for +# automatic dependency tracking. +# Keep this in sync with sister test `depcomp8b.test', which checks the +# same thing for libtool objects. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = zardoz +zardoz_SOURCES = foo.c sub/bar.c +END + +mkdir sub +cat > foo.c << 'END' +int main(void) +{ + extern int bar; + return bar; +} +END +cat > sub/bar.c << 'END' +extern int bar = 0; +END + +$ACLOCAL +$AUTOMAKE -a +grep include Makefile.in # for debugging +grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in +grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in +grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1 + +$AUTOCONF +./configure +$MAKE +./zardoz +$MAKE distcheck + +# Try again with subdir-objects option. + +echo AM_PROG_CC_C_O >> configure.in +echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am + +$ACLOCAL +$AUTOMAKE -a +grep include Makefile.in # for debugging +grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in +grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in +$EGREP 'include.*/(\.|sub)/\$(DEPDIR)' Makefile.in && Exit 1 + +$AUTOCONF +./configure +$MAKE +./zardoz +$MAKE distcheck + +: diff --git a/tests/depcomp8b.test b/tests/depcomp8b.test new file mode 100755 index 0000000..47aa303 --- /dev/null +++ b/tests/depcomp8b.test @@ -0,0 +1,73 @@ +#! /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 for regressions in computation of names of .Plo files for +# automatic dependency tracking. +# Keep this in sync with sister test `depcomp8a.test', which checks the +# same thing for non-libtool objects. + +required='libtool libtoolize' +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_LIBTOOL +AC_OUTPUT +END + +cat > Makefile.am << 'END' +lib_LTLIBRARIES = libzardoz.la +libzardoz_la_SOURCES = foo.c sub/bar.c +END + +mkdir sub +echo 'extern int foo = 0;' > foo.c +echo 'extern int bar = 0;' > sub/bar.c + +libtoolize + +$ACLOCAL +$AUTOMAKE -a +grep include Makefile.in # for debugging +grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in +grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in +grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1 + +$AUTOCONF +./configure +$MAKE +$MAKE distcheck + +# Try again with subdir-objects option. + +echo AM_PROG_CC_C_O >> configure.in +echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am + +$ACLOCAL +$AUTOMAKE -a +grep include Makefile.in # for debugging +grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in +grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in +$EGREP 'include.*/(\.|sub)/\$(DEPDIR)' Makefile.in && Exit 1 + +$AUTOCONF +./configure +$MAKE +$MAKE distcheck + +: 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 "z...@rd@z" >$@' >> $depdir/foo.Po + +$MAKE quux +$FGREP "z...@rd@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