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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=DQv+ 7xE0U16FkreezuHmV/RJtnsxcHHgSHVPyT9/XavrEOgLR0+rvaSYR7uOtGCJ3fk2 ksvg+RvFFEkskvIR+Wnb8Zjlaan/9Y/Nj1deEeXJCM/arwHt6XbjaEZWHppEMNrm vOVrFwl3YYTowS2EOooBg9Un1JqckbErkj4R3EM= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=qz6C/ruiYh xpC29w2LCER1ZP8zE=; b=SO04v8mBPya9XLxYnwj+h+x0S0kV4dNLVHn3x5RdlL RpZoFapIOB57L16Ds5niyhTO+5Hw2Y2HPi3Ts0ZJB5Dtb/Ssu+vXt9yTV1i7jqgC IPdSN3aTGGBdi06KMre2mgJyxRBe/Hexbz2iAS9+e+77WPEgYxRcZr9jXI5IRYBR Y= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.2 required=5.0 tests=BAYES_05,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=thorsten, taught, shopt, kampe X-HELO: mx1.redhat.com Subject: Re: /dev/stderr problem To: cygwin AT cygwin DOT com References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: <1957a989-fe56-ca68-ddc2-83bc59480ccd@redhat.com> Date: Mon, 17 Oct 2016 08:51:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8nsfJp9T36ma1pfrn5mGO2WmM9LTmIp5o" X-IsSubscribed: yes --8nsfJp9T36ma1pfrn5mGO2WmM9LTmIp5o Content-Type: multipart/mixed; boundary="27tBohWfAm3XJhfFo1jCaAaRVC4reiE75"; protected-headers="v1" From: Eric Blake To: cygwin AT cygwin DOT com Message-ID: <1957a989-fe56-ca68-ddc2-83bc59480ccd AT redhat DOT com> Subject: Re: /dev/stderr problem References: In-Reply-To: --27tBohWfAm3XJhfFo1jCaAaRVC4reiE75 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/17/2016 01:32 AM, Thorsten Kampe wrote: > * Thorsten Kampe (Mon, 17 Oct 2016 08:25:13 +0200) >=20 >> the following bash script results in a different output when=20 >> redirected to a file. >> >> ``` >> printf "FIRST LINE\n" > /dev/stderr >> shopt -os xtrace >> printf "SECOMD LINE\n" > /dev/stderr Cygwin treats '> /dev/stderr' as a request to truncate /dev/stderr (or, for that matter, any opening of a file under /proc/self/fd). Other platforms treat that as a special file that can never be truncated, but is instead reopened at the same offset. Maybe cygwin can be taught that opening a file through /proc/self/fd should preserve rather than reset offsets, but it will be a tricky patch, and someone has to write it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --27tBohWfAm3XJhfFo1jCaAaRVC4reiE75-- --8nsfJp9T36ma1pfrn5mGO2WmM9LTmIp5o Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYBNdgAAoJEKeha0olJ0NqHQcH/29T36ePMyBLRHJSKfUrxJUU ttCrM/79fs1XobwIvx9sV7LZzIYzoAK0NntC18B13EvBL7V/YY+UYhqs0R70Ezpw 6jzW01cqYlEnqK6EnYemL3B8AlBYoQ5i+Ak0bbwFc2DdFbEtmhF5Z5JEL9uU4rH4 QRF6SHPzYJWHGwh7qVjILit/0mqya/etnNMrdMSJvurZgQLnPum+z9iTogHp4B51 65GEerP74J5UKCf4kaW0oKjbmSJwCAik9LwUCQEWeBGvTCfmoj94vblpJyIk8yXL ky24KhIk/z1ZpL/N5rwQtspmPIGrrZEOoxXJI/CzH0Y8uiW15H9aBweFrp1xLPM= =/tpl -----END PGP SIGNATURE----- --8nsfJp9T36ma1pfrn5mGO2WmM9LTmIp5o--