delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/02/28/22:02:34

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:from:to:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=x/1Ts5WjVjiDvkl5h3l4MFPxFQsbDfiFeUIOKTu6Tkc
pSxuy73hyki0wl1TDUhn6fWT5lpHJUsg5IEC52Aq07jWKYLrFnot4UVeb/h8jYAs
6ezAUgXv7TqiM3unHfwdbjaQyuyhYlGOvCcb/iye9n9hNXfYboUoNK328WBTO2Es
=
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:from:to:references:in-reply-to:subject:date
:message-id:mime-version:content-type:content-transfer-encoding;
s=default; bh=k6xfzOsbDmXfzFHKxGGVczUevNE=; b=R9RPEVXjG/NOw41R9
laB+nliL3scOSrH3FO5514Brjd8J58iyzmpM1IMvWGnvveifugM5u1gLs9zXxi/W
OYAsz50WlyroeUc91ABRVvR3yW6+pboKK5/3A+gHTbeqHuPcUwPTSbMYdWMpCy8Y
I+GtYSJTqoW0stsDRXXYsCTA8k=
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=-0.0 required=5.0 tests=BAYES_40,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=HContent-Language:en-ca, H*UA:14.0, michel, Michel
X-HELO: sonic315-18.consmr.mail.bf2.yahoo.com
From: "Michel LaBarre" <michel DOT labarre AT rogers DOT com>
To: "'Alexander Pelevin'" <pvshura AT mail DOT ru>, <cygwin AT cygwin DOT com>
References: <002901d3b0fd$a30dee50$e929caf0$@mail.ru>
In-Reply-To: <002901d3b0fd$a30dee50$e929caf0$@mail.ru>
Subject: RE: Possible output redirect bug
Date: Wed, 28 Feb 2018 22:02:12 -0500
Message-ID: <000601d3b109$b33e8f80$19bbae80$@rogers.com>
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id w2132VYB005063

> Subject: Possible output redirect bug
> 
> Error output is not suppressed:
> 
> 
> $ cygstart cmd /c "(  >&2 pause ) >> test.txt"
> 
> $ cat /dev/null >> test.txt >/dev/null 2>&1
> bash: test.txt: Device or resource busy

The error message is not from the process running "cat" which is to what the
redirections apply.
The message is coming from the shell trying to setup file descriptors to
pass to the process running "cat" - you can see "bash:"
The shell cannot open the file for appending.

A simpler demonstration is:
$ cat < zorch > /dev/null 2>&1
bash: zorch: No such file or directory

Alternately:
$ ls zorch
ls: cannot access 'zorch': No such file or directory

shows std err is from "ls" and:
$ ls zorch 2> /dev/null
$
demonstrates redirection working.

Try instead:
( cat /dev/null >> test.txt ) >/dev/null 2>&1

Cheers,
Michel



--
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