Web lists-archives.com

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




On 2019-01-22 10:06, Corinna Vinschen wrote:
On Jan 22 09:57, Houder wrote:
On 2019-01-22 09:50, Houder wrote:
> On Sun, 6 Jan 2019 21:19:50, Corinna Vinschen  wrote:
> > This should work in the latest developer snapshot uploaded to
> > https://cygwin.com/snapshots/  Please give it a try.
> 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-@@

Not sure what you're testing.  This is the result for me on both,
Windows 8.1 and Windows 10 1809:

Curious! It fails (for me) on W7 ...

Not sure what you're testing.

STC inherits a "read-only" open file descriptor from bash. On Linux
the file can be opened read-write (via procfs), because a new entry
is created in the open file table.

(opening the file read-write (via fdescfs) on FreeBSD would fail)

For this reason the output does not show what has been entered via
the here-doc.

In short, I was merely testing the semantics of Linux.

)$ ./stca /dev/fd/0 <<EOF
? bla
? EOF
fd1 = 0
argv[1] = /dev/fd/0
fd2 = 3
buf = \
Hello, world!


Corinna

--
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