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 13039
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: <zsh-users@xxxxxxxxxx>
- Subject: Re: Under Cygwin ZSH, "diff -" fails unless forced into text mode
- Date: Thu, 17 Jul 2008 19:56:46 +0100
- Cc: <Gerald.Williams@xxxxxxxxxxxx>
- In-reply-to: <20080717085929.2356@blackhawk>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080717085929.2356@blackhawk>
On Thu, 17 Jul 2008 08:59:29 +0900
henman@xxxxxxxxxxxxxxxx wrote:
> 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%
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.
This is why zsh has both <(...) and =(...) process subtitution forms:
the second is a bit less efficient because it's guaranteed to expand to
a real file.
> 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.
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author