[Top][All Lists]

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

Re: popen binary mode patch

From: Eric Blake
Subject: Re: popen binary mode patch
Date: Mon, 22 Feb 2010 11:10:33 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090812 Thunderbird/ Mnenhy/

According to Bruce Korb on 2/22/2010 11:00 AM:
> This patch adds "binary mode" handling for popen() on platforms where
> the native popen() will not.  This is a problem especially on
> platforms where fopen() will ignore the 'b' but popen() will not.
> Hence, the test for "does fopen() accept a 'b'" won't apply to popen().
> GNU libc ought to just ignore the 'b', but it doesn't.

Thinking aloud here - do we even need a configure check?  Or would it just
be better to depend on the binary-io module, and use #if O_BINARY to
decide whether to strip 'b' before calling the real popen, and vs. letting
the underlying popen handle 'b'.  As far as I know, all systems with
non-zero O_BINARY support 'b' in popen().

Or maybe it is simpler to just rewrite sharutils to use:

popen (cmd, O_BINARY ? "rb" : "r")

rather than changing gnulib's popen module.

Why the change to popen-safer.c?  If we are replacing popen, then
popen_safer should get 'b' support for free by using rpl_popen.

The change to popen.m4 needs more work, if we do indeed decide to go with
a configure check.  It needs to use a cache variable, and provide sane
defaults for cross-compiling.

Should we file an enhancement bug report to glibc to add support for
ignoring 'b'?  It would be easier to justify this patch if we knew for
sure that glibc agrees with the concept of this extension.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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