Bash 3.1.17(8) CR/LF problem

mwoehlke mwoehlke@tibco.com
Wed Sep 27 21:03:00 GMT 2006


Malcolm Nixon wrote:
> I recently updated to Bash 3.1.17(8) and found my local build system
> failing due to the removal of CR/LF support:
> "A script on a binary mount that uses \r\n line endings will probably
> encounter syntax errors or odd variable assignments, because the \r is
> treated literally.  If this happens to you, use d2u to fix the line
> endings, or change your script to live in a text mount point.  A
> script  that resides on a text mount can have either line ending (even
> inconsistently mixed), but be aware that text mount points are
> slower,  due to \r\n filtering."
> 
> Unfortunately simply running "d2u" isn't a solution because:
>    * Some revision control systems make the files read-only.
>    * Some detect the change to <LF> as changes require manual merging.
>    * Some translate files to a "Local" format (CR/LF on Windows).

At least in some cases, there is a solution to this: use a Cygwin 
version of the RCS that knows that "native" means UNIX-style. :-) This 
works great for me (although I also go so far as specifying UNIX-style 
rather than "native").

> I think the bigger issue here is that this arbitrary change will break
> a "significant" number of existing scripts. I contract for a few
> companies that use Cygwin/Bakefile to achieve support for multiple
> compilers/tool-chains, and for hourly auto-build servers. This change
> will break all of them - some of which have been functional for over 4
> years.

It won't break ours. Nor did make-3.81. We DIRTFT (Did It Right The 
First Time). :-)

> In my opinion a better solution would have been to err on the side of
> compatibility and only use the new fast readline code if manually
> enabled.

I think a better solution would be to push for upstream to patch bash 
(probably as an option via shopt or an environment var or something) to 
just ignore '\r' at the end of a line. Interix has this problem also, 
and I think Rodney's version of bash does this (I know they went through 
this same issue, and the result was a bash that could always handle 
mixed line endings - I don't think Interix has any concept of a 'text 
mode' mount so it sees scripts like a UNIX would).

-- 
Matthew
The hippo made me do it! What? What do you mean you can't see the hippo?


--
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/



More information about the Cygwin mailing list