X-Recipient: archive-cygwin AT delorie DOT 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:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=hMb51mYNQSreCOdI GLy48X6m9stgogsjFgbXgCv7JA/uStxY6NnoR0dyXWATO3FLxh+ep90Fb7/koUOq ffcPLQSNcY6JTfT6nNnuThqOwr8BGGTVOKtLkk1C61APQGFA15hv5jLf67lI4/DU OnL/BzKiHdRSxduaRTOPnqIfIQw= 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:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=hR3Pdv6CMwgm+dIxj821rL UOe80=; b=awLp3gqYiGryUguoMZ37vtQKumhvz4A5cNzl1WmZZ9FJeJtEy4aim1 4CupV23jCqwxGPFDWsHq+ne9+juE1fUonMN53xJU4gaz2z5o3cegPfJvKwJw+xb9 lxzHTFaN+N8YLgzAK/0rBNPvQzmiD6MXExdsCgfGR9XieVnYF/Upc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=schneider, Schneider, Repin, andrey X-HELO: mailsrv.cs.umass.edu Reply-To: moss AT cs DOT umass DOT edu Subject: Re: Redirection to stderr References: <1761324316 DOT 20170710155536 AT yandex DOT ru> <581103da7715b704f454365749ab3b00 DOT squirrel AT mail DOT schneiderp DOT de> To: cygwin AT cygwin DOT com From: Eliot Moss Message-ID: <4020dbe3-bfb1-e0fc-22b2-0ab4e1330975@cs.umass.edu> Date: Mon, 10 Jul 2017 12:32:45 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <581103da7715b704f454365749ab3b00.squirrel@mail.schneiderp.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 7/10/2017 9:41 AM, Peter Schneider wrote: > On Mon, July 10, 2017 14:55, Andrey Repin wrote: >> Greetings, cygwin-mailinglist! >> >>> 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? >> >> echo aaa > a >> cat a > a > > The problem with "cat a > a" is entirely unrelated to "some-cmd > 2>/dev/stderr". (Apart from /dev/stderr not being a regular file, some-cmd > does not receive a path argument which it tries to open, the way "cat a" > does.) Understanding what is happening would require figuring out which process opens /dev/stderr and when. However, there is another approach that might get at what you want: /proc/nnnn/fd/2 gives access to file descriptor 2 (standard error) of process number nnnn. If you can get the right pid, and you have access rights, then you can open that. Here the PPID environment variable may be useful. Which stderr is it you're hoping the output will go to? Regards - EM -- 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