This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hang in bash when executing a script [regression between 1.3.12 and 1.3.20]





I work on an open-source test automation framework, STAF, which allows you
to start shell commands.  A user reported that when they try to run a
Cygwin bash shell command through the automation framework, and the script
itself calls into the automation framework, the script hangs.   I
originally was not able to reproduce the user's problem (the script did not
hang for me), but then I realized I was running Cygwin 1.3.12, and the user
was running Cygwin 1.3.20.  I then upgraded my Windows 2000 machine to
Cygwin 1.3.22, ran the exact same test, and the script would always hang.

Here is a script that demonstrates the problem:

#!/usr/bin/bash

export STAF_QUIET_MODE=1
echo "`date`: tests - starting"
STAFResult=`staf local ping ping`
RC=$?
PingResponse=$STAFResult
echo "Ping response = $PingResponse"
exit $RC

If I run this via:

$ bash --login -c c:/temp/test.sh

I get the correct output (and the script does not hang):

Fri Apr 25 15:53:59 CDT 2003: tests - starting
Ping response = PONG

If I run it via the automation framework:

$ staf local process start shell "c:/cygwin/bin/bash --login -c %C" command
c:/temp/test.sh stdout out.txt stderrtostdout returnstdout wait

the script hangs.  If I comment out the "STAFResult=`staf local ping ping`"
line, the script does not hang, but I don't get the PONG output:

Fri Apr 25 16:00:01 CDT 2003: tests - starting
Ping response =

If I change the first line of the original script to:

#!/usr/bin/sh

and run it via the automation framework, it does not hang and I get the
correct output:

Fri Apr 25 16:03:12 CDT 2003: tests - starting
Ping response = PONG

However, the user needs to use the original script (with /usr/bin/bash, not
/usr/bin/sh).

I'm not sure if this is a bug with the Cygwin bash implementation, but
there is certainly different behavior between 1.3.12 and 1.3.20.  I'd
appreciate any suggestions on how to resolve this issue.  The STAF
automation framework can be downloaded from
http://staf.sourceforge.net/getcurrent.php

Here is the Cygwin release:
CYGWIN_NT-5.0 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin

Thanks.

David Bender
Internet: bdavid at us dot ibm dot com


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]