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 duplicates > > > the steps taken by bash (and cat). > > > > This should work in the latest developer snapshot uploaded to > > https://cygwin.com/snapshots/ Please give it a try. > > This solves: <program> -i /dev/fd/N N<<EOF (i.e. Steven Penny's problem) > > Howver ... > (and I sure that I am not telling you anything new) > [...] > 64-@@ rm aap.txt # hacker removing the logfile > > 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 > > 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 -- Corinna Vinschen Cygwin Maintainer
signature.asc
Description: PGP signature