This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sed strips CRs

[adding bug-sed - see this thread in cygwin:]

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

Eric Blake    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]