bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen


From: Filipe Brandenburger
Subject: Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen
Date: Thu, 21 May 2015 09:36:18 -0700

Hi Eli,

On Thu, May 21, 2015 at 9:19 AM, Eli Zaretskii <address@hidden> wrote:
>> 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).

I think checking for whether popen accepts "rb" / "wb" is fine, but if
it's done, I think it should be done in gnulib and then gnulib could
provide one that accepts it regardless.

However, this was attempted before and rejected because it would
consider glibc as "broken" since it's actually the only one that
doesn't accept it...

Some reference to the original thread:
https://lists.gnu.org/archive/html/bug-gnulib/2010-02/msg00187.html

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

The problem is that it's currently impossible to cross-compile
sharutils without butchering the build system.

For instance, this is what Gentoo does to the "configure" script after
it's generated:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/sharutils/files/sharutils-4.14-popen-rb.patch?view=markup

> (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'.)

I think *all* of them support "rb" and "wb" to fopen, isn't that part
of POSIX anyways?

Any suggestions of what's the best way to solve this?

I had 3 suggestions on my original e-mail (which unfortunately wasn't
cc'd to bug-gnu-utils) but you can see them on Bruce's first reply
cc'ing the list:
http://lists.gnu.org/archive/html/bug-gnu-utils/2015-05/msg00003.html

Do you like any of those three?

Cheers,
Filipe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]