Subject: Re: Problem with stdout BINARY
From: [email-masked] (Jason Hickey)

13 Jun 1997 19:50:04 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Original-To: Larry Hall <[email-masked]>
Original-cc: [email-masked]
In-Reply-To: <[email-masked]>
X-Face: $tsnqT``tn7U3/uW*Z+d=O5bh1'T^86$3I(2EL0^#]<th-'d?|vJ")-$aJX?#bR|@%BNUb/
	`1r-eC{-5.[YSA&,: {b#V4y-,SS5&!-}NuZ$MR[D6Fl@Ub/>WvS6~GV41O5CQlf2}8#N,m>DFK}Ya`
	Wux,YSwY~w|CyQF?y1xruG]qR%BxY=Wcs)?|/
Original-Sender: [email-masked]

In the patch that I posted below for bash, I neglected to set pipes in
binary mode.  The fix is a small change to execute_cmd.c, where there
is an explicit call to setmode(fd, O_TEXT) for pipes.  I'm not sure
what the intension was in placing pipes in TEXT mode, but I would
rather have binary mode pipes.  This allows commands like
"zcat bash.tgz | tar xvf -".  I put the update in the same place,

    http://www.cs.cornell.edu/home/jyh/cygwin32/

Jason

Larry Hall writes:
 > Thanks!  This is excellent.  I've been planning to do something about this
 > oversight for quite a while but haven't gotten around to it.  I really 
 > haven't looked at what you've done yet but perhaps you can tell me, does
 > your change also fix the similar problem with pipes?
 > 
 > Larry
 > 
 > At 11:04 AM 6/12/97 -0400, you wrote:
 > > > At 11:29 AM 6/11/97 +0100, you wrote:
 > > > >Hi everybody,
 > > > >
 > > > >Trying to write gif file in stdout with 'putchar'. b18 seems to add a CRNL
 > > > >every CR he
 > > > >founds in the file.
 > > > 
 > >
 > >I've run into the same problem--for instance, if "x" is a binary file,
 > >the commands "dd if=x of=y" and "dd if=x > y" produce different
 > >results ("cat x > y" doesn't work because cat opens its input in TEXT
 > >mode).  This is an incredible headache, but the fix is pretty easy.
 > >
 > >You need to recompile bash, which always opens redirects in TEXT mode.
 > >You can download my patched copy of bash at
 > >
 > >    http://www.cs.cornell.edu/home/jyh/cygwin32/

-- 
Jason Hickey			Email: [email-masked]
Department of Computer Science	Tel: (607) 255-1372
Cornell University

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".