Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Under Cygwin ZSH, "diff -" fails unless forced into text mode
- X-seq: zsh-users 13040
- From: <Gerald.Williams@xxxxxxxxxxxx>
- To: <zsh-users@xxxxxxxxxx>
- Subject: RE: Under Cygwin ZSH, "diff -" fails unless forced into text mode
- Date: Thu, 17 Jul 2008 23:01:39 +0200
- Accept-language: en-US
- Acceptlanguage: en-US
- In-reply-to: <20080717195646.2c69e9b7@pws-pc>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080717085929.2356@blackhawk> <20080717195646.2c69e9b7@pws-pc>
- Thread-index: AcjoPuRfIUl5S6dFQ7OuI1/WXzfODgAC8wbQ
- Thread-topic: Under Cygwin ZSH, "diff -" fails unless forced into text mode
Peter Stephenson wrote:
>> zsh% cat foo | diff - foo
>> diff: -: Illegal seek
>> zsh%
>
> The short, but unsatisfactory, answer is that it's not required to
> work. diff expects to have a seekable file, for which a pipe doesn't
> necessarily qualify: it depends partly on the OS and also partly on how
> far back you need to seek, so you sometimes get away with it.
I'd call expecting stdin to be seekable a bug in diff,
although presumably ZSH-USERS isn't the right forum for
that discussion. (I guess HELP-GNU-UTILS would be.)
>> It passes if I force it into text mode:
>>
>> zsh% cat foo | diff -a - foo
>> zsh%
>
> There's some Cygwin-specific code in main.c to force read-only files
> into text mode. This is a fairly murky area and I have no idea how that
> affects pipes.
I'm not sure where you're headed with that one, but it
appears that ZSH is making the pipe appear as a binary
stream in this case. Forcing it *back* to text is what
fixes the problem.
I know there are similar issues with UTF-8 encodings on
Linux, and I have at times worked around it by setting
LANG= or LANG=C or something similar (I haven't delved
into it too deeply, although it looks like some of the
workarounds aren't as successful with some of the newer
versions of Linux). But this issue is happening all of
the time on Cygwin, and so far I haven't figured a way
to suppress it. Other shells do not act this way.
-Jerry
Messages sorted by:
Reverse Date,
Date,
Thread,
Author