public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "cygwin-mailinglist" <cygwin-mailinglist@schneiderp.de>
To: cygwin@cygwin.com
Subject: /dev/stderr invalid with nested and chained redirections
Date: Mon, 10 Jul 2017 07:18:00 -0000	[thread overview]
Message-ID: <76d702928e575369da13a1fce2fe4291.squirrel@mail.schneiderp.de> (raw)

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

             reply	other threads:[~2017-07-10  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10  7:18 cygwin-mailinglist [this message]
2017-07-10  7:39 ` Marco Atzeri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76d702928e575369da13a1fce2fe4291.squirrel@mail.schneiderp.de \
    --to=cygwin-mailinglist@schneiderp.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).