From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128377 invoked by alias); 10 Jul 2017 16:32:53 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 127115 invoked by uid 89); 10 Jul 2017 16:32:50 -0000 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 Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Jul 2017 16:32:49 +0000 Received: from [192.168.0.4] (c-24-62-203-86.hsd1.ma.comcast.net [24.62.203.86]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 97134404DE11; Mon, 10 Jul 2017 12:32:47 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: Redirection to stderr References: <1761324316.20170710155536@yandex.ru> <581103da7715b704f454365749ab3b00.squirrel@mail.schneiderp.de> To: cygwin@cygwin.com From: Eliot Moss Message-ID: <4020dbe3-bfb1-e0fc-22b2-0ab4e1330975@cs.umass.edu> Date: Mon, 10 Jul 2017 16:32:00 -0000 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 X-SW-Source: 2017-07/txt/msg00140.txt.bz2 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