delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/04/22:57:12

X-Spam-Check-By: sourceware.org
Message-ID: <45247489.2070100@byu.net>
Date: Wed, 04 Oct 2006 20:57:13 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Similar Bash 3.1.18 CR/LF Problem
References: <4C89134832705D4D85A6CD2EBF38AE0F7B137A AT PAUMAILU03 DOT ags DOT agere DOT com> <45245D1E DOT 2080903 AT byu DOT net> <20061005015804 DOT GA23547 AT trixie DOT casa DOT cgf DOT cx>
In-Reply-To: <20061005015804.GA23547@trixie.casa.cgf.cx>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019