Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen
Eli Zaretskii <[email protected]> Thu, 21 May 2015 19:19:25 +0300
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
> From: Filipe Brandenburger <[email protected]> > Cc: Eli Zaretskii <[email protected]>, > [email protected], > Filipe Brandenburger <[email protected]> > Date: Wed, 20 May 2015 22:15:46 -0700 > > Get rid of freadonly_mode and fwriteonly_mode which were set from a > define set by a configure AC_RUN_IFELSE check. > > Instead, use the previously already defined FOPEN_READ_BINARY and > FOPEN_WRITE_BINARY which are set based on O_BINARY from fcntl.h, which > will be defined to be non-zero on systems where there is a difference > between text and binary files. > > Remove the now unnecessary configure check for whether popen works with > binary mode. That particular check required running a program built by > configure, which made it hard or impossible to cross-compile sharutils > without patching the sources. I don't really care, but isn't that backwards? I always thought GNU projects preferred configure tests to manual #ifdef's based on subtle attributes of the underlying platforms (such as the fact that O_BINARY is non-zero). Maybe I'm missing something, but what is the rationale for these changes? IOW, what was wrong with the original code? (Apologies if I missed some discussion where this was explained.) (One reason why you may wish to leave that configure test is that many modern platforms support "rb" and "wb" in calls to 'fopen', but not in calls to 'popen'. AFAIR, glibc doesn't support binary modes in 'popen'.)