From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12200 invoked by alias); 22 Jan 2019 09:02:53 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12183 invoked by uid 89); 22 Jan 2019 09:02:52 -0000 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 Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.126.135) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Jan 2019 09:02:44 +0000 Received: from calimero.vinschen.de ([217.91.18.234]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M7aqD-1grcBI1zkD-0082A7 for ; Tue, 22 Jan 2019 10:02:41 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id EFE6AA805A3; Tue, 22 Jan 2019 10:02:40 +0100 (CET) Date: Tue, 22 Jan 2019 09:02:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.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@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <0f030e809f063f5a5e64ff7a7a0c3227@xs4all.nl> <20190106201950.GC4430@calimero.vinschen.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) X-SW-Source: 2019-01/txt/msg00166.txt.bz2 --32u276st3Jlj2kUU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1653 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" Content-length: 833 -----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--