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

Re: Possible ZSH bug with IO direction



On Apr 25,  3:08am, Roger Qiu wrote:
} Subject: Re: Possible ZSH bug with IO direction
}
} Thanks, the workaround did work. But I've never seen read & write 
} redirection at the interactive prompt. Does that make the STDIN for the 
} program I'm running readable and writable?

Yes.

} How does that work?

Stdin/out/err are just file descriptors 0/1/2.  They can be open in
whatever mode the parent process likes.  It wouldn't make much sense
to have stdin open for write only, but nothing prevents that.

Consider that /dev/tty is all of stdin/out/err for most interactive
programs.  It's open read/write even though programs don't usually treat
the individual descriptors that way.

} Can the program then rewind that descriptor, and write to `input.jpg`?

If the program were using system-call interfaces on descriptor 0, yes.
However the STDIO library object STDIN will still be initialized for
reading only, so in most cases the program won't notice.

} Also since Bash doesn't suffer from this problem, will this be fixed 
} eventually?

As the comment from main.c explains, it's a question of either breaking
a few external programs that care about raw file data, or breaking the
entire internal string-processing in e.g. zsh's parameter substitution
any time those strings are read from a file.  So I would expect the
answer is that this won't change unless Cygwin changes something.  Also,
we're woefully short on any volunteers for Windows-specific issues.



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