This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Handling of CYGWIN=binmode by bash


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
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]