automake-patches
[Top][All Lists]
Advanced

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

[PATCH] Work around a nasty bug of Solaris make (was: Segmentation fault


From: Stefano Lattarini
Subject: [PATCH] Work around a nasty bug of Solaris make (was: Segmentation fault with Solaris /usr/xpg4/bin/make)
Date: Fri, 6 Aug 2010 00:44:21 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

At Thursday 05 August 2010, Ralf Wildenhues wrote:
> Hello Stefano,
> 
> * Stefano Lattarini wrote on Thu, Aug 05, 2010 at 07:40:15PM CEST:
> > The test `parallel-tests9.test' fails on Solaris 10 when using
> > /usr/xpg4/bin/make as $MAKE, due to a submake invocation
> > returning an exit status `139' (i.e. a "Segmantation fault").
>
The bug in Solaris make is exposed by the following minimal testcase:

  $ cat Makefile
  foo1:
        $(MAKE) A="x " foo2
  foo2:
        $(MAKE) B=x foo3
  foo3:
        @echo $@ has run

  $ /usr/xpg4/bin/make
  /usr/xpg4/bin/make A="x " foo2
  /usr/xpg4/bin/make B=x foo3
  *** Signal 11 - core dumped
  make: Fatal error: Command failed for target `foo2'

The problem seems to be in the combination of nested recursive make 
calls and trailing whitespaces in a command-line defined macro. Weird.
 
> Thanks for the report.  A segfault in make is always a bug in the
> make implementation.  If we can easily find out what makes it
> fail, and can easily and reliably work around it, then let's maybe
> consider it, but otherwise let's not bother.
The attached patch does the fix.  It's basically just a one-liner
with a two-line comment.  I think we should apply it, since Automake
already contains tons of uglier and much more cumbersome workarounds.

> The user can always install GNU make.
"Don't hassle with writing portable makefiles, use a portable make 
instead!"...  A little bit against automake philosophy, isn't it? ;-)

Regards,
   Stefano
From e33bd26a021194ee400269888750db92cccb6af0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 6 Aug 2010 00:40:55 +0200
Subject: [PATCH] Work around a nasty bug (segfault) of Solaris make.

* lib/am/check.am (recheck, recheck-html): Trim trailing spaces
from $list, to avoid triggering a nasty bug (potential segfault)
on Solaris make.
---
 ChangeLog                      |    7 +++++++
 lib/Automake/tests/Makefile.in |    2 +-
 lib/am/check.am                |    4 +++-
 tests/Makefile.in              |    2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5ed00c6..590519f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-06  Stefano Lattarini  <address@hidden>
+
+       Work around a nasty bug (segfault) of Solaris make.
+       * lib/am/check.am (recheck, recheck-html): Trim trailing spaces
+       from $list, to avoid triggering a nasty bug (potential segfault)
+       on Solaris make.
+
 2010-07-31  Ralf Wildenhues  <address@hidden>
 
        Add example git work flow; discuss merge --log in HACKING.
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 4ed8c1e..0137661 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -464,7 +464,7 @@ recheck recheck-html:
                if read line < $$f; then                                \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
-             done | tr '\012\015' '  '`;                               \
+             done | tr '\012\015' '  ' | sed 's/ *$$//'`;              \
        $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) 
TEST_LOGS="'"$$list"'"'
 .pl.log:
        @p='$<'; $(am__check_pre) $(PL_LOG_COMPILE) "$$tst" $(am__check_post)
diff --git a/lib/am/check.am b/lib/am/check.am
index 755bf13..7fc0539 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -290,7 +290,9 @@ recheck recheck-html:
                if read line < $$f; then                                \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
-             done | tr '\012\015' '  '`;                               \
+## The apparently useless sed helps to avoid a nasty bug (a segmentation
+## fault!) on Solaris XPG4 make.
+             done | tr '\012\015' '  ' | sed 's/ *$$//'`;              \
        $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) 
TEST_LOGS="'"$$list"'"'
 
 .PHONY: recheck recheck-html
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 09da716..2fe7377 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1220,7 +1220,7 @@ recheck recheck-html:
                if read line < $$f; then                                \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
-             done | tr '\012\015' '  '`;                               \
+             done | tr '\012\015' '  ' | sed 's/ *$$//'`;              \
        $(MAKE) $(AM_MAKEFLAGS) $$target AM_MAKEFLAGS='$(AM_MAKEFLAGS) 
TEST_LOGS="'"$$list"'"'
 .test.log:
        @p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
-- 
1.7.1


reply via email to

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