Re: [PATCH 0/4] Cross compiling sharutils

Eric Blake <[email protected]> Fri, 22 May 2015 15:32:13 -0600
Newsgroups gmane.comp.gnu.utils.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 05/21/2015 10:50 PM, Filipe Brandenburger wrote:
> TL;DR: cygwin doesn't seem to need popen("rb") though mingw definitely does.
> 
> Even though cygwin does differentiate "r" and "rb", it my tests it
> seemed to be using binary by default. Not sure if that's a cygwin
> environment setting or if it was detecting that gzip output "looked"
> binary and was using binary that way...

Actually, https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
documents that CYGWIN=nopipe_byte defined in your environment will force
cygwin to default to handling pipe contents in text mode (the default is
pipe_byte, which handles pipe contents in binary mode).  Using
popen("rt") forces text mode; popen("rb") forces binary mode, and
popen("r") uses the settings of $CYGWIN to decide which mode to use
(usually binary, as the default of pipe_byte was set for a reason).

If you MUST test text mode pipes on cygwin, then you'll have to
experiment with changing $CYGWIN

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJVX6BdAAoJEKeha0olJ0NqLoUIAJAmEZYsqGzXD+WynyGXJJHA
3tLPOigq8/24CyFYnGPVpstxlAIRQwoTp6cuEsWZM35l8xO+0WrIyqicI3+Phe8L
PvbY9GVY3OZR93Ky6gpiU1k/rbIGJnPSklXI3AjoblDXslRQvkSbSHzRP8fOQxrN
Jmzv3Q5Q8wnnPE2+JRTMl3YYN8JTUDKd817Y1yftKlPlH2wH1VekvlZfXhIBvVsM
W6+G1SjWkAnM//2JfzAc6Khxrcsr7wmxR5A+G/B8+Ns/1UxBVocVNLqtMtb4yVNK
X9XgKvlBTNT/XpirquNaj4Q7E1Zzglq4CGOlkL72YbgMmlemsGU3qv12lxOXjuM=
=YD9J
-----END PGP SIGNATURE-----