X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Subject: Bash 3.1.17(8): Scripts on textmode mount get problems with CR characters Date: Tue, 10 Oct 2006 17:02:19 +0200 Message-ID: <93C4769E3BED6B42B7203BD6F065654C081FDE38@dmoexc01.emea.cpqcorp.net> From: "Bruun, Peter Michael \(HP C&I CME OSS CoE\)" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k9AF2ZFY007668 For various reasons (like various revision control systems), as described by others elsewhere, some of us prefer to follow the Windows standard of text file lines ending in CRLF when working on windows. It has been one of the main strengths of Cygwin tools, that all of them understood this. With release 3.1.8 of Bash, however, it no longer understands Windows conventions. In order to tell Bash to understand CRLF, instructions say, I should "just" mount the drive as "textmode", and all will be fine and work as before. However, I found that this instruction does not work, because textmode makes ordinary scripts fail. I have mounted my /cygdrive and /home directories as textmode: bash-3.1$ mount C:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmo de) C:\cygwin\home on /home type system (textmode) C:\cygwin\bin on /usr/bin type system (binmode) C:\cygwin\lib on /usr/lib type system (binmode) C:\cygwin on / type system (binmode) c: on /cygdrive/c type system (textmode,noumount) d: on /cygdrive/d type system (textmode,noumount) e: on /cygdrive/e type system (textmode,noumount) Now define this shell function: check() { ( cd $1 echo "ABC" > f.txt F=`cat f.txt` if [ "$F" != "ABC" ] ; then echo "Bash is broken in $1" else echo "Bash works in $1" fi rm f.txt ) } Now execute these calls: check /home/pmb check C:/Temp check /tmp I get: Bash is broken in /home/pmb Bash is broken in C:/Temp Bash works in /tmp With the previous version of bash all of these worked correctly. The reason is, that cat seems to pick up the \r character - it is not treated as whitespace, and so the result string is no longer identical to "ABC". I tried setting $IFS, but I could not make that change the behaviour - maybe I just lack instructions on how to get these characters into IFS. Since the above worked in previous versions, and since the above works on Linux, etc. I would tend to regard it as a regression that scripts do not work on textmode mounts, particularly since the new bash forces me to use textmode mounts. Or have I overlooked something? - Peter -- 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/