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: Similar Bash 3.1.18 CR/LF Problem

Hash: SHA1

According to Christopher Faylor on 10/4/2006 7:58 PM:
> Am I understanding what this change does correctly?
> It does not really fix the "CRLF problem".  Instead it just strips every
> \r that it finds regardless of whether the \r is before a \n, right?

Yes, igncr strips all \r, without looking whether it precedes \n.  I
modeled it after the igncr option of stty; isn't that the way terminals
behave when they have igncr turned on?  In other words, the shopt makes
bash treat files more like terminals.

> If this is right and you can do this level of surgery on bash's buffers
> is it harder to detect \r\n because the \n may not be in the current
> buffer so you don't know when to strip a \r at the end of the buffer?

Correct, but this was also what the existing upstream djgpp code did -
blindly stripping \r without trying to read ahead to see if there is \n.
Is it worth me trying to change the behavior to be more like fopen("rt"),
where the \r is stripped only if it precedes \n?  Remember, text modes
never see \r\n to begin with, \r seldom appears alone, and it is possible
to turn the shopt off if it does the wrong thing.

- --
Life is short - so eat dessert first!

Eric Blake   
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

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