delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/05/00:14:50

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 4 Dec 2008 21:12:59 -0800 (PST)
From: "Peter A. Castro" <doctor AT fruitbat DOT org>
To: "Hudec, Jan" <jan DOT hudec AT siemens DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: How do I prevent zsh from opening pipes and read redirections in text mode?
In-Reply-To: <3E4278088AD82C48B4663DDFE762CEF305A2DDED@prga004a.ww300.siemens.net>
Message-ID: <Pine.LNX.4.64.0812042101280.4752@gremlin.fruitbat.org>
References: <3E4278088AD82C48B4663DDFE762CEF305A2DDED AT prga004a DOT ww300 DOT siemens DOT net>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

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 AT fruitbat DOT org> or <Peter DOT Castro AT oracle DOT 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/

- Raw text -


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