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


-----BEGIN PGP SIGNED MESSAGE-----
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             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFJHSI84KuGfSFAYARAmExAKC3s38MfY3Yx/tIc8VeiZ2Zstu2YgCfaJlh
Cn//tYOTdxPcKTpLjzoIQHQ=
=Tuvh
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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