Bash is very, very stable (was: Bash returns incorrect process status)

Phil Betts Phil.Betts@heis.co.uk
Fri Sep 24 13:38:00 GMT 2004


Ronald Landheer-Cieslak wrote:
> Dolton Tony AB wrote:
> > I've noticed that bash doesn't get issued too often.
> It doesn't for three reasons:
> 1. the maintainer for Cygwin (that would be me) is very busy

Oooh!  Did you really mean to put your head above the parapet like
that?

> 2. The current version of Bash is very, very stable

Now that's just silly!  You're just tempting fate... ;-)

I have a problem with the cygwin port of bash which may be related to
the other reported problems with child processes.

Scenario, I often do something like this:

for i in *.c;do echo '***' $i '***';some-non-builtin-command;done|less

This works fine on Linux and various Unices, producing output like
this:

*** file1.c ***
output for file1.c
*** file2.c ***
output for file2.c
*** file3.c ***
output for file3.c

etc.

Under cygwin, this breaks down.  The output from echo is not correctly
interleaved with the output of the external command, producing
something like this:

*** file1.c ***
output for file1.c
*** file2.c ***
*** file3.c ***
output for file2.c
output for file3.c

AFAICT, the bunched builtin output always precedes the bunched
external output.  This suggests that either:
a) output from external commands is buffered whereas the output of
builtin commands is not. 
b) the external commands are run asynchronously as background tasks.

This only appears to be a problem if the output of the for-loop is a
pipe, but it may just be that piping the output increases the
likelihood of the problem occurring.

I can usually work around this by substituting /bin/echo for the
builtin echo - this works, but it's noticeably slower.

Although I've attached cygcheck output, the problem has been around
for several versions of cygwin/bash and it manifests itself on NT4.0,
W2K and (I think) Win98, so I don't suppose it'll cast any light on
the problem.

To head off any "PTC" type responses, I've no Windows environment on
my home PCs at the moment, and my boss wouldn't take kindly to me
working on cygwin.  However, I'll gladly test any fixes if you need
it.

Now, repeat after me...

  I, Ronald Landheer-Cieslak,
  will never claim in public
  that a program I maintain
  is "very, very stable"
  (even if it is).

Sorry if I spoiled your day ;-)

Phil Betts

 <<cygcheck.txt>> 
-- 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040924/2c0c4656/attachment.txt>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list