delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/10/03:18:25

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:message-id:date:subject:from:to:reply-to
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=m6G+6vEjcp91hRGUEXCP05SoCJqcc1TmQiHDF720tfZeo5VBbFwpO
+Yr2mXKfWKF+QqwIVgYyRap3uZNvFg1ZPt7HjXHUeePIj4wkyyUIj//oC81FbRim
TTlYMIAuY/DeiH7JosNwHQlqJa8mS/GzU/Lg3cWPnUSpODOZGJrtiY=
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:date:subject:from:to:reply-to
:mime-version:content-type:content-transfer-encoding; s=default;
bh=hTMKdoyXc6ASwrUh61+IqwnsG+g=; b=F5dZPSdpHk0SCHbaCCDgfrcP55L0
U0xh3QM6QLsvpRblbV5nJRRFIXjbHYI3CI/NN63RWLuraU0LXWrBEYl22Btzkn+D
F447CE2dPEQbtTlTNHh2TGVz3NRDQbjDF+1ROmxiS4V4/mmMNw1IyE05fVN4ecBr
37WNL3Bhj1h0ev8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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.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
Message-ID: <76d702928e575369da13a1fce2fe4291.squirrel@mail.schneiderp.de>
Date: Mon, 10 Jul 2017 09:18:03 +0200
Subject: /dev/stderr invalid with nested and chained redirections
From: "cygwin-mailinglist" <cygwin-mailinglist AT schneiderp DOT de>
To: cygwin AT cygwin DOT com
Reply-To: cygwin-mailinglist AT schneiderp DOT de
User-Agent: SquirrelMail/1.4.23 [SVN]
MIME-Version: 1.0

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019