X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-6.9 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4F391A38.6000505@redhat.com>
Date: Mon, 13 Feb 2012 07:12:08 -0700
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0
MIME-Version: 1.0
To: cygwin@cygwin.com, bug-sed@gnu.org
Subject: Re: sed strips CRs
References: <2BF01EB27B56CC478AD6E5A0A28931F203F560E4@A1DAL1SWPES19MB.ams.acs-inc.net>	<20120210150708.GA22832@calimero.vinschen.de>	<CA+sc5m=UkJRKK9WZCvcfsetSUc_CHkGC-gFZEher3Tg=fK=RkQ@mail.gmail.com>	<20120211100600.GA9823@calimero.vinschen.de> <CA+sc5mmnMBjBAqsuUdddEEwE5pgBDiGDkeV-H0WvEyZO08dMNA@mail.gmail.com>
In-Reply-To: <CA+sc5mmnMBjBAqsuUdddEEwE5pgBDiGDkeV-H0WvEyZO08dMNA@mail.gmail.com>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig3F58C8D899981FF46D42E849"
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--------------enig3F58C8D899981FF46D42E849
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

[adding bug-sed - see this thread in cygwin:
http://cygwin.com/ml/cygwin/2012-02/msg00313.html]

On 02/11/2012 10:19 AM, Earnie Boyd wrote:
>>> By this I assume you to mean that the -b option opens the input file
>>> in binary mode.  But the mount table the OP showed was already in
>>> binary mode.  Does sed not take that into consideration, I.E. it
>>> specifies the mode as a text file unless -b is specified, is this
>>> correct?
>>
>> Yes.  By default files are fopened using the "rt" mode on systems
>> supporting this mode.  This behaviour is hardcoded into upstream sed.
>=20
> But on Linux I would expect the "t" to be ignored and the file is open
> in "binary" mode anyway.

Personally, I think it is a bug that upstream sed is using 't' in
fopen() in the first place.  Linux does NOT have an 'rt' mode for a
reason: 't' is non-standard.  On cygwin, the preference used in
coreutils is that you get text mode by using 'r' and binary mode by
using 'rb', on the mount points where text mode matters; you should
almost never use 'rt' which forces text mode even on binary mounts.
That is, sed should be just fine using 'r' instead of 'rt', and it would
fix the perceived broken behavior on cygwin binary mounts.

But fixing this should be done upstream, and not in cygwin.

--=20
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--------------enig3F58C8D899981FF46D42E849
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPORo4AAoJEKeha0olJ0NqK1sIAIIPRTPbeCNilqyy2uJ+i7E9
TMISfFNCagBhto0eGQYk+SU33dES1XdDmY9DYJdrZmC9ziMe/cbdWaCC820EOl1E
EO9vZa3PUCNpDm6CxHnAsiiAfswIVZW3C9IRnvQpM3Z9I+rh+xepyu2ilhskN25M
isfLILG4o+7t65FWzia5J0i3NQkbfb6MG9YuiM78u79Ys598scFnUilGTrfV1bl8
BpfjuUO2YOqlMrKcZzJ9rI4eAM1KyM1yHF4hI6OtlXlBJAol9RxgUbl2rz3KMKNI
3Bjje+Ui49Emb7c55MMVKI4ErEioufZQ2GdYETWZmf9WuANLJFrJKHtbK77x2uE=
=AGDa
-----END PGP SIGNATURE-----

--------------enig3F58C8D899981FF46D42E849--
