Subject: Re: Handling of CYGWIN=binmode by bash
From: [email-masked] (Pierre A. Humblet)

17 Nov 1998 21:51:19 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]

To answer my own question, I found out that what matters with redirection
is the value of CYGWIN at the time the shell is launched, not at the time
redirection occurs. In the examples below I was changing CYGWIN inside bash
(which had no immediate effect) then calling ash where the new settings
became effective.

Pierre

At 05:15 PM 11/16/98 -0500, Pierre A. Humblet wrote:
>I have noticed an inconsistency in the way ash & bash handle CYGWIN=binmode
>in b20 on Win95.
>Drive a: is not mounted. It contains a file "empty" and a 
>file "crnl" containing CR NL
>The program "tell_mode" reports on stderr the modes of stdin and stdout.
>
>bash: mount
>Device           Directory           Type        Flags
>\\.\tape1:       /dev/st1            native      text!=binary
>\\.\tape0:       /dev/st0            native      text!=binary
>\\.\b:           /dev/fd1            native      text!=binary
>\\.\a:           /dev/fd0            native      text!=binary
>c:               /                   native      text=binary
>
>The unexpected results occur with bash on line 5 below (compare with 2).
>The redirected input/output are opened as TEXT (I expected BINARY).
>Note that as expected the program "cat" opens BINARY under ash and bash
>(lines 3 & 6, compared with 8). 
>
>1 ash: echo $CYGWIN
>tty binmode
>2 ash: tell_mode < a:/empty > a:/out
>fd = 0 BINARY
>fd = 1 BINARY
>3 ash: cat a:/crnl | od -c
>0000000  \r  \n
>
>4 bash: echo $CYGWIN
>tty binmode
>5 bash: tell_mode < a:/empty > a:/out
>fd = 0 TEXT
>fd = 1 TEXT
>6 bash: cat a:/crnl | od -c
>0000000  \r  \n
>
>7 bash: CYGWIN=tty
>8 bash: cat a:/crnl | od -c
>0000000  \n
>
>I am happy to report that all other tests I have performed yield the
>expected results.
>
>Pierre
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"[email-masked]" with one line of text: "help".
>
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".