delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/21/10:39:13

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Disclaimed: 45854
To: cygwin AT cygwin DOT 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 AT accelrys DOT com>
Date: Fri, 21 Dec 2007 15:38:28 +0000
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019