Subject: bug#14707: automake 1.14 test hang for t/compile4.sh on Linux if "cl" executable is in path

From: Stefano Lattarini <[email-masked]>
Date: Thu, 27 Jun 2013 11:20:28 +0200

tags 14707 + patch
tags 14707 - moreinfo
thanks

On 06/24/2013 11:35 PM, Diab Jerius wrote:
>
> On Mon, 2013-06-24 at 23:22 +0200, Stefano Lattarini wrote:
>>
>> On 06/24/2013 04:45 PM, Diab Jerius wrote:
>>>
>>> On the Linux boxes I compile on, there's a /usr/local/bin/cl executable
>>> (from the IRAF package).  Unfortunately, it seems that t/compile4.sh
>>> interprets that as a Microsoft compiler.
>>>
>>> The IRAF cl is an interactive program,
>>> 
>> What happens if the program is run with its stdin redirected from /dev/null?
>> Does it exit immediately, or does it still hang?
> 
> It exits, quite verbosely:
> 
> % cl < /dev/null
> Warning: no login.cl found in login directory
>       apropos     fitsutil    lists       phist       stecf       utilities
>       color       gemini      mscred      plot        stlocal     xray
>       ctio        gmisc       nmisc       proto       stsdas      
>       dataio      images      noao        rvsao       system      
>       dbms        language    obsolete    softools    tables      
> 
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> ERROR: use `logout' to log out of the CL
> ecl> % 
> 
Thanks, this is what I needed.  Below is a patch that I hope should
fix your problem.  Can you give it a try?

>> Also, does the program support a --version or --help option that might
>> lead us to rule it out?
> 
> Indeed, it does:
> 
> % cl --version
>     NOAO/IRAFNET PC-IRAF Revision 2.14.1 Mon Sep 15 10:12:05 MST 2008
>
>>
>>> so compile4.sh invokes it and it hangs waiting for input.
>>>
>> (Which is quite annoying indeed).

Thanks,
  Stefano

---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

>From ec163633dd590bfdbd8d7fd147492081018507f7 Mon Sep 17 00:00:00 2001
Message-Id: <ec163633d[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Thu, 27 Jun 2013 11:11:35 +0200
Subject: [PATCH] tests: don't risk hanging on the 'cl' requirement

On the GNU/Linux boxes of some users that run our testsuite there
is a '/usr/local/bin/cl' executable, from the IRAF package:

    <http://iraf.noao.edu/>

The test 'compile4.sh' (and other tests) try to invoke the 'cl'
command to check whether it's a Microsoft compiler; the IRAF cl
is an interactive program, so it hangs on such invocation.  In
conclusion, the testsuite hangs for those users which have the
IRAF cl early in PATH.

Fix the issue by redirecting the input of cl from /dev/null when
invoking it, which is enough to prevent the cl program from IRAF
from hanging, and should have no effect on the behaviour of the
Microsoft compiler.

This change fixes automake bug#14707.

* t/ax/am-test-lib.sh (require_tool): Adjust the handling of
the 'cl' requirement.

Signed-off-by: Stefano Lattarini <[email-masked]>
---
 t/ax/am-test-lib.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index 182b070..26e58ef 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -788,7 +788,11 @@ require_tool ()
       # in the environment "by hand" before calling the testsuite.
       export CC CPPFLAGS
       echo "$me: running $CC -?"
-      $CC -? || skip_all_ "Microsoft C compiler '$CC' not available"
+      # The IRAF package (http://iraf.noao.edu/) contains a 'cl' program
+      # which is interactive, and which could cause the testsuite to hang
+      # if its standard input is not redirected.  See automake bug#14707.
+      $CC -? </dev/null \
+        || skip_all_ "Microsoft C compiler '$CC' not available"
       ;;
     etags)
       # Exuberant Ctags will create a TAGS file even
-- 
1.8.3.1.448.gfb7dfaa