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: Eli Zaretskii
Subject: Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen
Date: Thu, 21 May 2015 20:09:43 +0300

> Date: Thu, 21 May 2015 09:36:18 -0700
> From: Filipe Brandenburger <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> 
> 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...

Ahm...

> 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

AFAIU, you are saying that the popen-binary test relies on running a
program, which of course is a cross-compilation killer.

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

I think so, yes.  But not for 'popen', AFAIK.

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

If a better test for popen-binary cannot be written that only compiles
and links a program, then I guess your solution is the next best,
indeed.

Thanks.



reply via email to

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