www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/23/12:36:55

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
Subject: Re: bug bash-3.1.17(9) : CR problems when using cat to generate cmd line arguments
X-Sybari-Space: 00000000 00000000 00000000 00000000
From: "Howard Mak" <hmak AT vaultus DOT com>
MIME-Version: 1.0
References: <op DOT thvurhc7lokn5a AT slate>
Date: Mon, 23 Oct 2006 12:35:53 -0400
Message-ID: <op.thvu13cslokn5a@slate>
In-Reply-To: <op.thvurhc7lokn5a@slate>
User-Agent: Opera Mail/9.02 (Win32)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

------------tFnpeG62Tht0kqcDs1AIpz
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit

Apparently, the attachment in my previous email got dropped.  Here it is again.

- Howard

On Mon, 23 Oct 2006 12:29:31 -0400, Howard Mak wrote:

> I can't seem to get the latest version of bash to work with the command
> 	PROGRAM `cat file_containing_arguments.txt`
> when the file is created on a textmode mount.  Seems like carriage returns are not processed correctly.
>
> I've attached a test script illustrating the problem.
>
> Comments:
>
> -	The problem does not seem to appear in older version of bash (ver 3.1.17(6))
>
> -	I tried using different settings for the shell option igncr, but it didn't seem to help
>
> Thanks in advance for any help.
>
> - Howard

------------tFnpeG62Tht0kqcDs1AIpz
Content-Disposition: attachment; filename=cr_test.sh.txt
Content-Type: text/plain; name=cr_test.sh.txt
Content-Transfer-Encoding: 7bit

#!/usr/bin/bash
#
# Following 2 tests should both pass.
# Instead, 1st test fails in newer version of bash, but not on older version.

shopt -s igncr

pwd

# Result: /c/tmp

mount

# Result:
# c:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmode)
# C:\cygwin\bin on /usr/bin type system (textmode)
# C:\cygwin\lib on /usr/lib type system (textmode)
# C:\cygwin on / type system (textmode)
# c: on /c type system (textmode)
# d: on /d type system (textmode)
# j: on /j type system (textmode)
# k: on /k type system (textmode)
# t: on /t type system (textmode)
# y: on /y type user (textmode)
# z: on /z type user (textmode)


################################################################################
# Test 1
# Passes in bash 3.1.17(6)-release
# Fails  in bash 3.1.17(9)-release

echo bar.txt > bar.txt

od -c bar.txt

# Result:
# 0000000   b   a   r   .   t   x   t  \r  \n
# 0000011

notepad `cat bar.txt`

# Open fails because `cat` output returns CR?

################################################################################
# Test 2
# Passes in bash 3.1.17(6)-release
# Passes in bash 3.1.17(9)-release

dos2unix -U bar.txt

od -c bar.txt

# Result:
# 0000000   b   a   r   .   t   x   t  \n
# 0000010

notepad `cat bar.txt`


------------tFnpeG62Tht0kqcDs1AIpz
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


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