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

On Sat, Feb 11, 2012 at 5:06 AM, Corinna Vinschen wrote:
> On Feb 10 14:44, Earnie Boyd wrote:
>> On Fri, Feb 10, 2012 at 10:07 AM, Corinna Vinschen wrote:
>> > On Feb 10 08:02, Nellis, Kenneth wrote:
>> >> Cygwin 'sed' seems to be stripping CRs from its input.
>> >> Linux sed doesn't do this. Example:
>> >
>> > Try the -b option.
>> 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.  I.E. the sed process would receive the CR
for CRLF line endings.  And since the OP's file systems were binary
mode I would have expected it to have been the same.  Except that
Cygwin has created a documented exception to this for the case of
binary vs text mode being explicitly specified in the call.  So while
it is expected behavior as defined by Cygwin it is unexpected behavior
if I believe Cygwin to be similar in operation to Linux.


Problem reports:
Unsubscribe info:

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