X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:in-reply-to:references:date:subject
	:from:to:cc:reply-to:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=xdnH6+e4WLF4k2ci
	Bq3hop8NNWuB8JyNdex63jEfvwnFTC467eMdS1Pl2YNAyv/FvWWkksRyAQGPX5Jl
	VuUJcfDttxOT6DBEYNUgGwuAAC+LtKNcAugMmxw9JFSxFEgzQy1VWG2QRDb+89kz
	bPkHBNtA1yLuj9/LZoWVbiVdAvU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:in-reply-to:references:date:subject
	:from:to:cc:reply-to:mime-version:content-type
	:content-transfer-encoding; s=default; bh=DyA/I1njK0KuHF0QxqJ0H3
	vyjeA=; b=cAgBJtAByzDB4Ymh0Q4zOFcXRax7pWGcxXgXlM0r4NjaFCKUmnTSN2
	eKJ2WgtW65Gi+gEHpQcDeu5bezMEM0IHitXBRJ7FgpEcWCe7/G2xi5ue9B9u5/RG
	bgnSF+tsFvigmh5KwA/M4ze+aBKFjOfJIYp+E3hABxyWchR6xiysQ=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*UA:SquirrelMail, H*M:squirrel, H*r:SquirrelMail, H*u:SquirrelMail
X-HELO: www.schneiderp.de
Message-ID: <ec89b6011aad4b68a294d3f1d462d40b.squirrel@mail.schneiderp.de>
In-Reply-To: <b4de479d-882e-4e61-2916-1b54f318d76c@gmail.com>
References: <baa3a4f84968dd6aa9869d2c9f58197f.squirrel@mail.schneiderp.de>    <b4de479d-882e-4e61-2916-1b54f318d76c@gmail.com>
Date: Mon, 10 Jul 2017 14:01:55 +0200
Subject: Re: Redirection to stderr
From: "cygwin-mailinglist" <cygwin-mailinglist@schneiderp.de>
To: "Marco Atzeri" <marco.atzeri@gmail.com>
Cc: "cygwin@cygwin.com" <cygwin@cygwin.com>
Reply-To: cygwin-mailinglist@schneiderp.de
User-Agent: SquirrelMail/1.4.23 [SVN]
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-IsSubscribed: yes

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
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

