This is the mail archive of the
mailing list for the Cygwin project.
Re: Similar Bash 3.1.18 CR/LF Problem
-----BEGIN PGP SIGNED MESSAGE-----
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 firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v220.127.116.11 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html