automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Work around a bug in Solaris make's file-inclusion mechanism.


From: Stefano Lattarini
Subject: [PATCH] Work around a bug in Solaris make's file-inclusion mechanism.
Date: Sat, 15 May 2010 13:59:39 +0200
User-agent: KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; )

[From a thread in address@hidden
[<http://comments.gmane.org/gmane.comp.sysutils.automake.bugs/4893>]

Hello Ralf.  I went ahead and wrote a patch to apply your changes.  I
added my name too in the ChangeLog entry, since I wrote a test to
verify the change (this test fails under both GNU make and heirloom
make without your change, and passes under both if it is applied).

With the patch applied, the testsuite shows no regression on my Debian 
box with both GNU make (3.81) and Heirloom make (2007).

At Tuesday 20 April 2010, Ralf Wildenhues <address@hidden> 
wrote:
> * Stefano Lattarini wrote on Tue, Apr 20, 2010 at 04:50:54PM CEST:
> > While trying out the Automake testsuite using Heirloom make as
> > $MAKE. I encounterd a failure in test `subobj9.test'.  Attached
> > here are the test log and the testscript-generated Makefile and
> > Makefile.in heirloom make is chocking upon.  Let me know if you
> > need more information.
> >
> > + /opt/heirloom/bin/make print
> > make: fatal error: line 273: cannot get /src/.deps/bar.Plo for
> > including .
> 
> Interesting.  Does the patch below make the test pass for this
>  make, or does only it fail later on then?  If it passes, does it
>  also suffice to only add the first of the two added lines?
> 
> I'm trying to understand which of these lines this make interprets
> wrongly:
>   include file
>   include ./file
>   include .//file
It turned out that this is enough to trigger the failure.
>   include sub/file
>   include sub//file
>   include ./sub/file
>   include .//sub//file
>   include "file"
>   include "./file"
>   include ".//file"
>   include "sub/file"
>   include "sub//file"
>   include "./sub/file"
>   include ".//sub//file"
>
> because we might just be able to improve the test in m4/make.m4 to
> detect that limitation.
IMHO your change to automake.in is sufficient (I added a verbose comment 
too, to make the purpose of the new code clearer).
> 
> Thanks,
> Ralf
> 
> diff --git a/automake.in b/automake.in
> index f25674b..d34e1dd 100644
> --- a/automake.in
> +++ b/automake.in
> @@ -2142,6 +2142,8 @@ sub handle_single_transform ($$$$$%)
>           my $depfile = $object;
>           $depfile =~ s/\.([^.]*)$/.P$1/;
>           $depfile =~ s/\$\(OBJEXT\)$/o/;
> +         $depfile =~ s,//*,/,;
This solves the problem.
> +         $depfile =~ s,^\./,,;
This seems not to be necessary.
>           $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
>                        . basename ($depfile)} = 1;
>       }

The final patch is attached.

Regards,
     Stefano
From e8564bde13356283faa678ec6369bf9df628850b 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 Solaris make's file-inclusion mechanism.

* automake.in (sub handle_single_transform):  Collapse multiple
slash characters into a single one (in the name of the depfile).
* tests/subobj11.test: New test.
* tests/Makefile.am (TESTS): Updated.

Report by Stefano Lattarini, fix by Ralf Wildenhues, final patch
by Stefano Lattarini.
---
 ChangeLog           |   11 +++++++
 automake.in         |   11 +++++++
 tests/Makefile.am   |    1 +
 tests/Makefile.in   |    1 +
 tests/subobj11.test |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 0 deletions(-)
 create mode 100755 tests/subobj11.test

diff --git a/ChangeLog b/ChangeLog
index a026c84..2ea8843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-14  Ralf Wildenhues  <address@hidden>
+           Stefano Lattarini  <address@hidden>
+
+       Work around a bug in file-inclusion mechanism of Solaris make.
+       * automake.in (sub handle_single_transform):  Collapse multiple
+       slash characters into a single one (in the name of the depfile).
+       * tests/subobj11.test: New test.
+       * tests/Makefile.am (TESTS): Updated.
+       Report by Stefano Lattarini, fix by Ralf Wildenhues, final patch
+       by Stefano Lattarini.
+
 2010-04-20  Ralf Wildenhues  <address@hidden>
 
        Fix -Werror handling for presence of configure.in and configure.ac.
diff --git a/automake.in b/automake.in
index 4a753db..df6b5b3 100644
--- a/automake.in
+++ b/automake.in
@@ -2127,6 +2127,17 @@ sub handle_single_transform ($$$$$%)
            my $depfile = $object;
            $depfile =~ s/\.([^.]*)$/.P$1/;
            $depfile =~ s/\$\(OBJEXT\)$/o/;
+           # 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.
+           $depfile =~ s,//*,/,g;
            $dep_files{dirname ($depfile) . '/$(DEPDIR)/'
                         . basename ($depfile)} = 1;
        }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cff34c5..aae6a6c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -670,6 +670,7 @@ subobj7.test \
 subobj8.test \
 subobj9.test \
 subobj10.test \
+subobj11.test \
 subobjname.test \
 subpkg.test \
 subpkg2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3ff9012..5f43c38 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -911,6 +911,7 @@ subobj7.test \
 subobj8.test \
 subobj9.test \
 subobj10.test \
+subobj11.test \
 subobjname.test \
 subpkg.test \
 subpkg2.test \
diff --git a/tests/subobj11.test b/tests/subobj11.test
new file mode 100755
index 0000000..ed2ae0c
--- /dev/null
+++ b/tests/subobj11.test
@@ -0,0 +1,76 @@
+#! /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.
+
+. ./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
+foo_SOURCES = .//src/foo.c  # the `.//' is meant.
+END
+
+mkdir src
+
+echo 'main() {}' > src/foo.c
+
+$ACLOCAL
+$AUTOMAKE -a
+
+# Be lax in the regexp, to account for automake conditionals, the
+# use of @am__include@, and similar stuff.
+grep 'include.*//' Makefile.in && Exit 1
+
+# Try to make sure that the file inclusion in the makefile are
+# really working.
+$AUTOCONF
+./configure --enable-dependency-tracking
+
+$MAKE distcheck
+
+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 QUUX' >> $depdir/foo.Po
+
+$MAKE quux >out || { cat out; Exit 1; }
+grep QUUX out
+
+:
-- 
1.6.5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]