This is the mail archive of the
mailing list for the Cygwin project.
Re: Broken since 1.3.10, or earlier
- From: Randall R Schulz <rrschulz at cris dot com>
- To: <dan at danamis dot com>, cygwin at cygwin dot com
- Date: Tue, 16 Jul 2002 17:00:38 -0700
- Subject: Re: Broken since 1.3.10, or earlier
I take it that by "inconsistent" you mean the relative ordering of the
output of the "grep" processes and of the "echo" commands is not the strict
alternation you'd expect.
That's what I see, anyway. I even saw two lines of grep output that follow
the shell prompt printed after the command "completes."
It seems there's some asynchrony in the processing of the output and that
somehow, in effect, there's a race condition.
I believe we've seen other reports of similar problems.
Someone who knows about the internal architecture of I/O processing in
Cygwin might be able to shed some light on this. If, for example, there's
some kind of queuing of I/O operations in Cygwin1.dll between the
application code (grep or a shell, in this case) and the Windows I/O
primitives, then there might be an opportunity for this kind of asynchrony.
It's too bad strace cannot solve this one, but since there's the shell plus
one grep for each file to be examined, it's not going to help resolve
relative timing issues.
Lest you think this is just idle speculation ... Well it is ... But here's
a concrete suggestion on a work-around:
grep -R --include='*.java' Copyright .
If you need those other lines interleaved with the just file names, you can
(grep -R --include='*.java' Copyright tau rrs;
grep -l -R --include='*.java' Copyright tau rrs) |sort
This may do everything twice, but on Cygwin, anyway, it's distinctly faster
than your original, what with it's repeated invocation of grep.
I hope you find that helpful.
Mountain View, CA USA
At 16:31 2002-07-16, Dan Higgins wrote:
If I want to recursively find all files that contain some text, I use, for
find . -name '*.java' | while read l; do grep 'Copyright' "$l" && echo "$l";
The output from this pipeline is inconsistent. Mostly I see bogus pathnames
that should not be there, or missing pathnames that should be there, or
duplicate lines from the grep, that sometimes even wind up overlapped by the
command prompt upon completion.
1. Don't suggest another syntax, unless it can handle paths with
spaces in it.
2. I have already tried adding "2>&1" in various places
throughout the line.
3. This works fine on Unix and MKS.
4. My system is Windows 2000 SP2, 1.3GHz Athlon.
5. I had Cygwin 1.3.10. I just upgraded to 1.3.12, including
all freshly downloaded packages. No change.
6. I have already searched Google and the cygwin ml archives.
7. It has caused me much pain between the ears.
I have not been able to narrow it down to a particular program, but I
suspect it has to do with piping, stdin, stdout, and Windows' general lack
of those concepts. Whatever it is, it seems pretty fundamental to me.
Any info or advice could end the pain. That would be greatly appreciated.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html