Subject: bug#10427: coreutils-8.14.116-1e18d: testsuite failures on NetBSD 5.1

From: Paul Eggert <[email-masked]>
Date: Thu, 05 Jan 2012 01:00:35 -0800

I'm sending this to bug-automake because I think it's an automake
issue.  However, the problem causes the latest coreutils snapshot
to fail to build, so I'm CC'ing to bug-coreutils.

> On 01/03/2012 06:10 PM, Jim Meyering wrote:
>> FYI, here's a snapshot of what will soon be coreutils-8.15,
>> expected on Thursday or Friday.
>>
>> coreutils snapshot:
>>   http://meyering.net/cu/coreutils-ss.tar.xz      5.2 MB
>>   http://meyering.net/cu/coreutils-ss.tar.xz.sig
>>   http://meyering.net/cu/coreutils-8.14.116-1e18d.tar.xz

This snapshot doesn't build on Solaris 8 (sparc) with native tools,
for a couple of reasons.  I don't expect Solaris 8 is an active
porting target any more, but these problems could well happen on
active targets.

First, there's code like this in tests/Makefile.in:

	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) "$$tst" \
	$(AM_TESTS_FD_REDIRECT)

This code is generated by Automake.  Here, AM_TESTS_FD_REDIRECT
is empty.  Solaris 8 'make' executes the above as follows:

   bash -c '[expansion of previous line] \'

and Bash complains about a syntax error with the trailing backslash.

How about changing Automake to generate something like this instead,
with no backslash-newline?

	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) "$$tst" $(AM_TESTS_FD_REDIRECT)

This should avoid the problem.

Second, there's code like this in tests/Makefile.in:

	@list='$(TEST_LOGS)'; \
	list=`for i in $$list; do \
	  test .log = $$i || echo $$i; \
	done | tr '\012\015' '  '`; \
	list=`echo "$$list" | sed 's/ *$$//'`; \

This generates a long line and sends it to 'sed',
which complains "Output line too long." and outputs nothing.

This code is also generated by Automake.  How about changing Automake
to generate something like this instead?

	@test_logs='$(TEST_LOGS)'; \
	list=; \
	for i in $$test_logs; do \
	  test .log = "$$i" || list="$$list $$i"; \
	done; \

This avoids the business with echo and tr and ` sed and
avoids the sed limitation with long lines.

Automake does this latter sort of thing in about 4 places,
and I figure it's done that way for a reason, but I don't
know what the reason is.