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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=cH7aE2clKQtbyRsswbMT277LMHotsQtV+MdKpvsfxrgnulAIQteNi lDTu1qOCXFf0wWsAzkF64SY4FZJkzwcwZwyXOOqVfJthhl7J8QkpfTO6FwMwauQa aR4+YkL7hxUQBt0EDNpR2fJ9GHxBbTy/A4fobNat8slFKAtG8U37g0= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=V77tcQmNlADH3768FNseFqmb9s0=; b=DGXPj8d+S/fcnT35fUpyp7TeFh3R TNDeDYiuIhYMUczGhXKwvxHLU45M5hAzdaIib8xnazq4+3muAuj3bn8SOndMz0I5 Sy/6TgqmF1/WGnzIBz3bz+0QdMi+gTbSeTBJYg4uOvbnqvtEBAjXnycEzfJPOdyP auOeix7cg4ZCZr8= 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-Spam-SWARE-Status: No, score=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=81, 8.1, H*MI:sk:d643173, device X-HELO: mout.kundenserver.de Date: Tue, 22 Jan 2019 10:02:40 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux Message-ID: <20190122090240.GJ2802@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <0f030e809f063f5a5e64ff7a7a0c3227 AT xs4all DOT nl> <20190106201950 DOT GC4430 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="32u276st3Jlj2kUU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) --32u276st3Jlj2kUU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jan 22 09:50, Houder wrote: > On Sun, 6 Jan 2019 21:19:50, Corinna Vinschen wrote: > > > Also see: > > > > > > https://cygwin.com/ml/cygwin/2018-12/msg00028.html > > > ( Bash heredoc on FD 3 ) > > > > > > Based on the output of strace on Linux, I composed an STC, that dupli= cates > > > the steps taken by bash (and cat). > >=20 > > This should work in the latest developer snapshot uploaded to > > https://cygwin.com/snapshots/ Please give it a try. >=20 > This solves: -i /dev/fd/N N<=20 > Howver ... > (and I sure that I am not telling you anything new) > [...] > 64-@@ rm aap.txt # hacker removing the logfile >=20 > 64-@@ stat -L /proc/4120/fd/3 > File: /proc/4120/fd/3 > Size: 4 Blocks: 1 IO Block: 65536 regular file > Device: 33d91880h/869865600d Inode: 35747322042382612 Links: 0 > Access: (0644/-rw-r--r--) Uid: ( 1000/ Henri) Gid: ( 513/ None) > Access: 2019-01-22 09:24:41.978178200 +0100 > Modify: 2019-01-22 09:24:41.978178200 +0100 > Change: 2019-01-22 09:26:25.021040800 +0100 > Birth: 2019-01-22 09:24:41.978178200 +0100 >=20 > 64-@@ cp /proc/4120/fd/3 noot.txt # logfile rescue > 64-@@ cat noot.txt # empty! (however, this works on Linux) > 64-@@ cat /proc/4120/fd/3 # indeed, does not show contents > 64-@@ Yes, this does not work under older systems. However, it works as desired at least with Windows 10 1709 due to changes in the OS in terms of handling of deleted files. I tested this with W8.1, W10 1709 and W10 1809. It fails on 8.1 but works fine on both W10 versions. Corinna --=20 Corinna Vinschen Cygwin Maintainer --32u276st3Jlj2kUU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlxG3DAACgkQ9TYGna5E T6Cc7w//aQ2a694Zt9pjHXr7FQHA8B4Gg32R0tAyNEzbIoGFXq7YLxmFR/dUN91Y G6uZBbX1TSjAKQD+Ew0HP1/yriVOyLDdy0pLA59etOthstHiltXm0aieph4gdpsG uJo1C+5DnUbcgotUjFdUHm1DScyJphgZ50mt0ROOxU+EC+YpwOnKLjZBmZ9u+z3C FTtJ4M43wP5q0WaBu2snAQ26BNYz/aLdaRSGB8r7a3f5/Pz5igG2e/bq4Xx5c/rT 1ZUblzpfMl1sWa+2GoeGy5/dmwJAspsY563an8jVpRqW+5WyW812aNl4K3Z6vXBP zJOmdCW1BfXbVGuAsLAKMIdprsQeJsbCxnB939+mqBKZst1RSfM8LLJ2LgqdbUZ7 TK4nNfukMOntLrPUAscgyaQk0rOaJIT5k3H8VzXEYCL1sWWh3jEnd5+Zd5Pm6P7D 1WQ5IF/+NI9DHiuyTgmtUkU4FBy6ersllT3TIERA1wgLa9VMpm2S+bqEPwbVkAQE EOg2OgH/PAtZQDJuGWvvFJsDLjkI2UwgDnxjxQAUExJvhHKsRgS63b0lbgGgWKzJ GPmBwpup1iW56jA7ylcmGSSeMp4aRdaJQQ0dcV1HlpH2vyQ9UtlmXGaFnW1DIKf+ lBBjsyUZwxnVoS6/Og6k1gMu6KHwdQ7IGnU4jceUc+FeneF5HbM= =2RRn -----END PGP SIGNATURE----- --32u276st3Jlj2kUU--