Greetings, Bruno Haible!

> In Gnulib, we have a unit test that compiles the program below as a
> native Windows program (either with mingw or with MSVC), that exercises
> the Gnulib select() function
>  
> <https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/select.c;h=5a58d6ee47f5b10413d97cb7a1996d424eefc796;hb=HEAD>

> Then it does (in a Cygwin shell):

>   rm -f t-select-in.tmp
>   ./test-select-fd.exe r 0 t-select-in.tmp < /dev/null
>   cat t-select-in.tmp

> Up to Cygwin 3.6.0, the contents of the file t-select-in.tmp was "1",
> like on most other OSes, indicating that the program can read() from
> file descriptor 0.

But "< /dev/null" literally means "don't read from STDIN".
As far as I recall (correct me if I'm wrong), READING from /dev/null is
undefined and may result in undetermined behavior.

> In Cygwin 3.6.1, the contents of the file t-select-in.tmp is "0",
> indicating that read()ing from file descriptor 0 would block.
> This is a regression.

What I've gathered is that in most cases reading from /dev/null should
immediately return EOF.


-- 
With best regards,
Andrey Repin
Monday, April 14, 2025 14:31:08

Sorry for my terrible english...


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to