From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99542 invoked by alias); 10 Jul 2017 07:18:09 -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 99514 invoked by uid 89); 10 Jul 2017 07:18:07 -0000 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*u:SquirrelMail, H*M:squirrel, H*MI:squirrel X-HELO: www.schneiderp.de Received: from www.schneiderp.de (HELO www.schneiderp.de) (213.239.199.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Jul 2017 07:18:06 +0000 Received: from localhost ([127.0.0.1] helo=mail.schneiderp.de) by www.schneiderp.de with esmtp (Exim 4.80) (envelope-from ) id 1dUSxH-0006Db-M0 for cygwin@cygwin.com; Mon, 10 Jul 2017 09:18:03 +0200 Received: from 80.146.228.93 (SquirrelMail authenticated user ppeterr) by mail.schneiderp.de with HTTP; Mon, 10 Jul 2017 09:18:03 +0200 Message-ID: <76d702928e575369da13a1fce2fe4291.squirrel@mail.schneiderp.de> Date: Mon, 10 Jul 2017 07:18:00 -0000 Subject: /dev/stderr invalid with nested and chained redirections From: "cygwin-mailinglist" To: 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-SW-Source: 2017-07/txt/msg00129.txt.bz2 I have a script which does not find /dev/stderr when its stderr is redirected and piped. The minimal reproduction follows below. This is a verbatim copy from the terminal with edited-in comments prefixed with hashes. $ uname -a CYGWIN_NT-6.1-WOW xxxxxxxx 2.8.1(0.312/5/3) 2017-07-03 14:06 i686 Cygwin $ bash --version GNU bash, version 4.4.12(3)-release (i686-pc-cygwin) [...] ######################################################## $ cat say-something.sh #!/bin/sh echo something > /dev/stderr ######################################################## ############### This is the error: $ (x=$(./say-something.sh 2> /dev/stderr)) |& cat ./say-something.sh: line 2: /dev/stderr: No such file or directory ############### Variants without sub-shell, piping or redirection work: $ (x=$(./say-something.sh 2> /dev/stderr)) | cat something $ (x=$(./say-something.sh 2> /dev/stderr)) something $ x=$(./say-something.sh 2> /dev/stderr) |& cat something $ (x=$(./say-something.sh > /dev/stderr)) |& cat something $ (x=$(./say-something.sh 2> /dev/stdout)) |& cat $ -- 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