/dev/fd/N not synonymous with file descriptor N; it is on Linux

Houder houder@xs4all.nl
Tue Jan 22 08:57:00 GMT 2019


On 2019-01-22 09:50, Houder wrote:
> On Sun, 6 Jan 2019 21:19:50, Corinna Vinschen  wrote:
>> 
>> On Dec 16 17:31, Houder wrote:
>> > 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 should work in the latest developer snapshot uploaded to
>> https://cygwin.com/snapshots/  Please give it a try.
>> 
>> Thanks,
>> Corinna
> 
> Nice!
> 
> 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)
> 
> it still not the same as Linux ...
> 
> So, for the record only:

and as another example, this STC succeeds on Linux ..., but fails on 
Cygwin.

64-@@ ./stca /dev/fd/0 <<EOF
> bla
> EOF
fd1 = 0
argv[1] = /dev/fd/0
fd2 = 3
id = writefd2, errno = 13, errstr = Permission denied
64-@@

=====

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stca.c
Type: text/x-c
Size: 6104 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190122/8e2810aa/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