How do I prevent zsh from opening pipes and read redirections in text mode?

Peter A. Castro doctor@fruitbat.org
Fri Dec 5 05:14:00 GMT 2008


On Thu, 4 Dec 2008, Hudec, Jan wrote:

> Hello Folks,

Greetings, Jan,

> I have a program (actually a cygwin program -- git-fast-import) that
> reads commands from standard input and absolutely needs the stream to be
> binary (byte counts to be read are included in some commands). However,
> zsh forces it's input to text mode both when I run: 
> git-fast-import < file
> and
> cat file | git-fast-import
> despite me having all the mounts set to binary and CYGWIN=binary. How do I explain to zsh, that pipes and read redirections to commands must be binary?

I believe it's "binmode", not "binary".

Anyway, I can't seem to repro your symptoms.

I've created a binary file and can both direct input to, or pipe it via
cat, to 'od -xc' and it looks correct to me.

Try this:

In bash:
$ od -xc < /bin/zsh.exe > od.bash

In zsh:
$ od -xc < /bin/zsh.exe > od.zsh

$ ls -al od.*
-rw-r--r-- 1 doctor None 23550 Dec  4 21:06 od.bash
-rw-rw-r-- 1 doctor None 23550 Dec  4 21:06 od.zsh

$ sum od.*
23760    23 od.bash
23760    23 od.zsh

Works for me!

If 'od' can get a binary stream, then so should your program.
Try using cat for your input and see if it fixes it for you:

cat file | git-fast-import

> Note, that zsh used not to do this and bash is not doing it either.

Don't know what to tell you.  Nothing has really changed in this area.

-- 
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
 	"Cats are just autistic Dogs" -- Dr. Tony Attwood

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



More information about the Cygwin mailing list