Gerald Pfeifer <ger...@pfeifer.com> writes:

> On Fri, 23 Nov 2018, Tom de Vries wrote:
>> When building libbacktrace, we typically use elf.c, and don't build 
>> pecoff.c, xcoff.c or unknown.c
>> 
>> Add testcases that use unused format to ensure that we also build and
>> test those on a typical development setup.
>
> This is a good idea!
>
>> Bootstrapped and reg-tested on x86_64.
>
> Unfortunately, on i586-unknown-freebsd11 I'm now seeing the likes of
>
>   gmake[3]: *** [Makefile:1086: xcoff_32.lo] Error 1
>   xcoff_64.c:54:29: error: extra tokens at end of #undef directive [-Werror]
>      54 | #undef BACKTRACE_XCOFF_SIZEn#define BACKTRACE_XCOFF_SIZE 64
>         |                             ^
>   xcoff_64.c:54:29: warning: extra tokens at end of #undef directive
>      54 | #undef BACKTRACE_XCOFF_SIZEn#define BACKTRACE_XCOFF_SIZE 64
>         |                             ^
>   cc1: all warnings being treated as errors
>   gmake[3]: *** [Makefile:1086: xcoff_64.lo] Error 1
>
> The reason is that GNU sed supports \n in the replacement pattern
>
>   % echo "abc" | sed -E 's:b:\n:' 
>   a
>   c
>
> whereas BSD sed does not
>
>   % echo "abc" | sed -E 's:b:\n:' 
>   anc
>
> so the following in libbacktrace/Makefile.am doesn't work:
>
>   xcoff_%.c: xcoff.c
>       SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
>       REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define BACKTRACE_XCOFF_SIZE'; \
>       $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
>               $(srcdir)/xcoff.c \
>               > $@
>
>
> I believe that in addition to FreeBSD this probably also fails on
> Solaris and Darwin.

I cannot test Darwin right now, but Solaris sed is indeed affected.  On
Solaris 10 where there's only /usr/bin/sed (and /usr/xpg4/bin/sed which
has the same issue), the failure does occur.  On Solaris 11 where I have
GNU sed earlier in PATH, the issue is hidden.

Your patch does indeed fix the problem with Solaris 10 /bin/sed.

Unfortunately, libbacktrace is one of those libraries that don't produce
Dejagnu-style .sum and .log files, so test failures are buried in the
make check output and very easily overlooked.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to