This is the mail archive of the
mailing list for the Cygwin project.
Re: Redirection to stderr
- From: "cygwin-mailinglist" <cygwin-mailinglist at schneiderp dot de>
- To: "Marco Atzeri" <marco dot atzeri at gmail dot com>
- Cc: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Mon, 10 Jul 2017 14:01:55 +0200
- Subject: Re: Redirection to stderr
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <firstname.lastname@example.org>
- Reply-to: cygwin-mailinglist at schneiderp dot de
On Mon, July 10, 2017 12:33, Marco Atzeri wrote:
> On 10/07/2017 11:06, cygwin-mailinglist wrote:
>> Rationale aside, it is a bug, isn't it?
> I guess a side effect of a lost race.
Which race, exactly?
> Redirecting something on itself it is not guarantee to work.
I'm not sure it is on itself. Are these not two different streams?
When "some-cmd 2> /dev/stderr" is interpreted by the shell I would expect
that /dev/stderr points to a pipe or terminal *of that shell*. The fd 2 in
"2>", on the other hand, should be the standard error stream *of
some-cmd*. The redirection plugs the two together. Similar reasoning
applies to the outer layers of the redirection onion. Each process has a
/dev/stderr which stays (or, rather, should stay) valid until that process
ends. If there is a redirection, the inner process (e.g. some-cmd) must
not "free" or "delete" the pipe or whatever it is now attached to upon
exit; that stream belongs to the caller, e.g. the shell.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple