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

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:reply-to:to:references:in-reply-to
:subject:date:message-id:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=QW5yPGlxICZ3QC/H
F0E0Uxp9iNLsD90QkbxYgJOcpSEU+f338kxqLiURVRIDh2IyKDx1KKYuTFfwmTVL
BjT4K/RJPt5R5K0SoPO1MPAx1jtkctIoPNmajKctsSN+FbNZPoAU8l1b9W5aaqKv
Kmh6I8HiNa6HQrCpmKXh1DJ4cNI=
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:reply-to:to:references:in-reply-to
:subject:date:message-id:mime-version:content-type
:content-transfer-encoding; s=default; bh=BBOI7iQjmnES0lfpKQliPX
YUvqQ=; b=NXw+U69EKgSdHEVfNS08mO1bXEN2+/5FXbJZXfnPFntV8RmYOsDSzt
ZLUWNEZcULXwtVdBGtihgUItoECKZmtn7Yr/FSUPbptkCc82Op+d3KsXQrJlNwIO
gt72YCn+/Hvwkx1bEIM3/Q/8pvliuw3DplXvquf/7txOTADSo5vAU=
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=-3.6 required=5.0 tests=BAYES_00,CYGWIN_OWNER_BODY,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*UA:14.0, H*x:14.0, H*Ad:D*rogers.com, HTo:D*rogers.com
X-HELO: smtp29.i.mail.ru
From: "Alexander Pelevin via cygwin" <cygwin AT cygwin DOT com>
Reply-To: "Alexander Pelevin" <pvshura AT mail DOT ru>
To: "'Michel LaBarre'" <michel DOT labarre AT rogers DOT com>, <cygwin AT cygwin DOT com>
References: <002901d3b0fd$a30dee50$e929caf0$@mail.ru> <000601d3b109$b33e8f80$19bbae80$@rogers.com>
In-Reply-To: <000601d3b109$b33e8f80$19bbae80$@rogers.com>
Subject: RE: Possible output redirect bug
Date: Wed, 28 Feb 2018 19:10:27 -0800
Message-ID: <004501d3b10a$dbd4c4e0$937e4ea0$@mail.ru>
MIME-Version: 1.0
Authentication-Results: smtp29.i.mail.ru; auth=pass smtp.auth=pvshura AT mail DOT ru smtp.mailfrom=pvshura AT mail DOT ru
X-7FA49CB5: 0D63561A33F958A5BF920E6501D0F2F4BE1F7E35EDD5F5A1E7AD16DE97A7840B725E5C173C3A84C3FB9365559B687AC8E784EF1E49A2C5414DCCFF368A6260CFC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F5D41B9178041F3E72623479134186CDE6BA297DBC24807EABDAD6C7F3747799A
X-Mailru-Sender: BE74EBDE453618ED828AA4518828FD8DB1863855D50B10E7B32D05BDCDDCD82A03250B6556CD55C76F6EBB475F845BFDFB559BB5D741EB96DA6DC86FA87B7B1B3A5DB60FBEB33A8A0DA7A0AF5A3A8387
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id w213A1q2005502

You are right, thank you for the explanation.

Alex.

-----Original Message-----
From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of
Michel LaBarre
Sent: Wednesday, February 28, 2018 7:02 PM
To: 'Alexander Pelevin'; cygwin AT cygwin DOT com
Subject: RE: Possible output redirect bug

> 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



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