Re: Gnulib's freopen replacement and MinGW

2012-05-07 Thread Bruno Haible
Hi Eric, Thank you for digging out the previous threads on this topic. Eric Blake wrote: > Wy back when, coreutils used to use SET_BINARY. We changed that to > use freopen(NULL) because of the POSIX wording that allowed NULL to > change mode, because cygwin honored the mode change, and becau

Re: Gnulib's freopen replacement and MinGW

2012-05-07 Thread Eric Blake
[adding coreutils] On 05/07/2012 12:11 PM, Bruno Haible wrote: > Eric Blake wrote: >> POSIX says that such a call is implementation-defined, so technically, >> mingw DOES implement the POSIX semantics (by defining that it is >> unsupported). > > Yes. So, code in freopen.c that would try to suppor

Re: Gnulib's freopen replacement and MinGW

2012-05-07 Thread Bruno Haible
Eric Blake wrote: > POSIX says that such a call is implementation-defined, so technically, > mingw DOES implement the POSIX semantics (by defining that it is > unsupported). Yes. So, code in freopen.c that would try to support a NULL argument in all cases - would be a gnulib extension, - would

Re: Gnulib's freopen replacement and MinGW

2012-05-07 Thread Eli Zaretskii
> Date: Mon, 07 May 2012 06:44:00 -0600 > From: Eric Blake > CC: bug-gnulib@gnu.org, bug-gnu-ut...@gnu.org > > > FILE * > > rpl_freopen (const char *filename, const char *mode, FILE *stream) > > { > > #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ > > - if (filename != NUL

Re: Gnulib's freopen replacement and MinGW

2012-05-07 Thread Eric Blake
On 05/05/2012 05:18 AM, Eli Zaretskii wrote: > Diffutils 3.2 call xfreopen with its first argument NULL, expecting > the underlying reopen to handle this. However, the MS runtime does > not implement the Posix semantics of such a call, POSIX says that such a call is implementation-defined, so tec

Re: Gnulib's freopen replacement and MinGW

2012-05-05 Thread Eli Zaretskii
> From: Bruno Haible > Cc: bug-gnu-ut...@gnu.org > Date: Sat, 05 May 2012 16:26:55 +0200 > > > Diffutils 3.2 call xfreopen with its first argument NULL, expecting > > the underlying reopen to handle this. However, the MS runtime does > > not implement the Posix semantics of such a call, and so,

Re: Gnulib's freopen replacement and MinGW

2012-05-05 Thread Bruno Haible
Hi Eli, > Diffutils 3.2 call xfreopen with its first argument NULL, expecting > the underlying reopen to handle this. However, the MS runtime does > not implement the Posix semantics of such a call, and so, for example, > MinGW-compiled cmp fails when invoked to compare its stdin with a > file: >

Gnulib's freopen replacement and MinGW

2012-05-05 Thread Eli Zaretskii
Diffutils 3.2 call xfreopen with its first argument NULL, expecting the underlying reopen to handle this. However, the MS runtime does not implement the Posix semantics of such a call, and so, for example, MinGW-compiled cmp fails when invoked to compare its stdin with a file: D:\gnu\diffutils-