Hi Jim,

On 01/03/11 07:17, Jim Meyering wrote:
> I now see that your patch ... combined stderr with the potentially
> mangled output from a failing "cat" command,...
> 
> Also, while it's not likely that the file is missing at that point,
> it is possible, since there is a race condition.

And if the file contains trash exclusive of 0x0A and starts with
0x30 through 0x39 then you'll get hosed, too.  You have to make
a trade off between programming complexity and usefulness.
If "cat" has a read error, the most likely output will be only
to stderr and you won't have junk.  "cat" would have to use
multiple reads before it would emit junk data before printing
an error message.  It would not make particular sense to read
line-at-a-time.

This whole series of emails came about because some GIT command
emitted a fatal error message to stderr, git-version-gen ignored
the "fatal" error and I was left wondering what happened.
Perhaps the real "best" solution would be to divert all stderr
to a temp file.  It would be printed out on real failure and
otherwise simply removed.

I'll supply that patch, if you like.
Is it okay to use the post-1977 concept of a shell function?
Even the Solaris /bin/sh supports it .....

Cheers  - Bruce

Reply via email to