Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Under Cygwin ZSH, "diff -" fails unless forced into text mode



I saw the following question at the cygwin group and figure that it is a zsh related question.   

I tried to see if setopt NO_MULTIOS had any bearing on the problem, but it didn't.

The question follows:


--------  extract
From: <Gerald.Williams@xxxxxxxxxxxx>
To: <cygwin@xxxxxxxxxx>
Date: Wed, 16 Jul 2008 23:19:02 +0200
Subject: Under Cygwin ZSH, "diff -" fails unless forced into text mode

Does anyone know why, under Cygwin ZSH, the following fails?

 zsh% cat foo | diff - foo
 diff: -: Illegal seek
 zsh%

It passes if I force it into text mode:

 zsh% cat foo | diff -a - foo
 zsh%

And of course it works in bash:

 bash% cat foo | diff - foo
 bash%

It doesn't matter whether I'm running under a console window or
in RXVT, and experimenting with $LANG didn't seem to make any
difference. I do not see this problem on various flavors of Unix
(with various versions of ZSH: 3.0.8 through 4.2.0).

- ---

I imagine this probably relates to the following:

 zsh% set | grep ZSH
 Binary file (standard input) matches
 zsh% set | grep -a ZSH
 ZSH_NAME=3Dzsh
 ZSH_VERSION=3D4.3.4
 zsh%

which of course also works correctly in bash:

 bash% set | grep BASH
 BASH=3D/usr/bin/bash
 BASH_ARGC=3D()
 BASH_ARGV=3D()
 BASH_LINENO=3D()
 BASH_SOURCE=3D()
 BASH_VERSINFO=3D([0]=3D"3" [1]=3D"2" [2]=3D"39" [3]=3D"19" [4]=3D"release"=
 [5]=3D"i686-pc-cygwin")
 BASH_VERSION=3D'3.2.39(19)-release'
 bash%

I get similar behavior on Linux, although that's caused by
Unicode (I think). I have at times been able to fix it in
Linux by playing around with $LANG, although I don't seem
to be able to fix it that way under Cygwin.

- ---

Am I forgetting the trick to make these pipes work without
the forced text conversions? It seems like there's also an
issue with diff it it's trying to seek on a pipe, even if
it *does* think it's binary. :-)

- -Jerry

> deleted cygcheck attached file....



Messages sorted by: Reverse Date, Date, Thread, Author