X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
X-Disclaimed: 45854
To: cygwin@cygwin.com
Subject: sh.exe hangs when invoked from make without a terminal
MIME-Version: 1.0
X-Mailer: Lotus Notes Release 7.0.1 January 17, 2006
Message-ID: <OFF6CD940C.DC215CF2-ON802573B8.005306DE-802573B8.0055EB45@accelrys.com>
From: Stephen Bennett <sbennett@accelrys.com>
Date: Fri, 21 Dec 2007 15:38:28 +0000
Content-Type: text/plain; charset="US-ASCII"
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

test.pl:
----
$childpid=fork;
die "failed to fork" if (!defined $childpid);
if (! $childpid) {
    close STDIN;
    close STDOUT;
    close STDERR;
    exec "make -f test.mk &>test.out";
}
----
test.mk:
----
var=$(shell echo foobar | cat)
 
default:
        @echo "$(var)"
----

Running "make -f test.mk" from a terminal works as expected -- "foobar" is 
echoed. Running test.pl, however, causes the sh.exe process to hang 
apparently indefinitely -- the first time I observed this was in an 
overnight cronjob, and `sh -c "echo xml4csrc2_2_0 |tr 'a-z' 'A-Z'"` had 
been running for approximately 11 hours.

The trigger appears to be the combination of make, the pipeline appearing 
in the shell command, and not being attached to a terminal. If I remove 
any of these factors (by removing the '| cat', changing 'make -f test.mk' 
into 'sh -c "echo foo | cat"', or running "make -f test.mk" from a 
terminal), the problem does not manifest itself and everything behaves as 
expected. I've so far managed to reproduce the problem on three different 
machines with versions 3.1.17 and 3.2.25 of bash, and versions 1.5.24-2 
and 1.5.25-7 of the cygwin DLL.

Any suggestions?


Accelrys Limited (http://www.accelrys.com)
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK
Registered in England: 2326316


--
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/

