/dev/fd/N not synonymous with file descriptor N; it is on Linux
Houder
houder@xs4all.nl
Sun Dec 16 16:31:00 GMT 2018
L.S.,
/dev/fd/N not synonymous with file descriptor N; it is on Linux
64-@@ cat /dev/fd/0 <<\EOF
> Hi
> EOF
cat: /dev/fd/0: No such file or directory
fails on Cygwin; not on Linux.
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 STC succeeds on Linux, but fails on Cygwin.
What does the STC do:
- it creates a (temporary) file in the same way that bash does
- the file is written to, the file descriptor is closed and the file
unlinked
- however, before the file is unlinked, it is opened a second time,
like bash
would do
Next
- the file /dev/fd/N is opened, where N is the file descriptor that has
been
left open; this is what the "cat command" would do.
The "cat command" on Linux succeeds; it fails on Cygwin.
Regards,
Henri
STC attached (hopefully)
=====
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stc.c
Type: text/x-c
Size: 3256 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20181216/d65ea54d/attachment.bin>
-------------- next part --------------
--
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
More information about the Cygwin
mailing list