From: Andrew Pimlott <andrew@pimlott.net>
To: zsh-workers@sunsite.dk
Subject: overeager multios
Date: Sun, 9 Feb 2003 23:26:44 -0500 [thread overview]
Message-ID: <20030210042644.GT27419@pimlott.net> (raw)
I just spent several minutes trying to understand a behavior that
turned out to be caused by unexpected triggering of multios. A
simple example is
echo hello 3>&1 >&2 | cat
which prints "hello" twice, instead of once as in bash. (In
reality, "echo hello" would be a program that writes to both fds 1
and 3.) I think multios is overeager here, as this is a standard
shell idiom, and the only way I know of to achieve this effect.
A fix would be to ignore (for multios purposes) previous opens when
a fd is duped. the shell would process the above as follows.
1. fd 1 will be opened to the pipe. Push that open onto the
multios stack for fd 1.
2. fd 1 will be duped to fd 3. Clear the multios stack.
3. fd 2 will be duped to fd 1. Push that open onto the multios
stack.
4 fd 1 has only one entry in its multios stack, so don't trigger
multios.
This will ensure that multios only triggers on a command line that
has no useful meaning in sh.
I know I can turn off multios, but I think we can have the best of
both with the above algorithm.
I am using the zsh 4.0.6-13 package on Debian GNU/Linux.
Andrew
PS. Please Cc: me as I am not subscribed.
reply other threads:[~2003-02-10 4:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030210042644.GT27419@pimlott.net \
--to=andrew@pimlott.net \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).