From: Tom Boyd <tvboyd23@gmail.com>
To: zsh-workers@zsh.org
Subject: Documentation about Multios is misleading, and perhaps untrue
Date: Wed, 10 Oct 2018 22:33:15 -0400 [thread overview]
Message-ID: <CAO1rNLg3Y=W8=r6FSOyBLfjcvKmduit6UQGYwrDGKvVEHwOQJg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]
In the section of the manual about Multios, the manual states:
If the user tries to open a file descriptor for reading more than once, the
shell opens the file descriptor as a pipe to a process that copies all the
specified inputs to its output in the order specified, similar to cat,
provided the MULTIOS option is set. Thus
sort <foo <fubar
or even
sort <f{oo,ubar}
is equivalent to ‘cat foo fubar | sort’.
This last statement seems to be untrue. The apparent behavior I see in zsh
is that for commands of the form:
commandword < file1 < file2
file1 and file2 must be successfully opened by the shell *before* the
command is even executed. if the opening of any of the listed input files
fails or blocks, then execution of the command also fails or blocks until
all openings are unblocked.
Conversely, the command:
cat file1 file2
causes the shell to immediately execute the cat command, which then
*itself* the assumes responsibility of opening the files listed as
arguments, in order. cat has different semantics than multios: cat
*immediately* begins processing the files listed as arguments from left to
right, stopping only when it reaches the first one that blocks and resuming
when it finishes open. Also if cat encounters a file that fails to open, it
merely skips it and continues down the argument list.
myprocess < file1 < namedpipe &
will block entirely until namedpipe is opened on the sender side and only
then will it start proccessing file1.
Conversely
cat file1 namedpipe | myprocess
will immediately start processing file1, block and wait for namedpipe to
open on the sender side, and then continue processing its fed data.
What should be done about this ?
-
tom
next reply other threads:[~2018-10-11 2:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 2:33 Tom Boyd [this message]
2018-10-11 4:05 ` dana
2018-10-11 19:12 ` Bart Schaefer
2018-10-11 20:35 ` Daniel Shahaf
2018-10-11 20:59 ` Bart Schaefer
2018-10-12 8:30 ` Peter Stephenson
2018-10-16 0:45 ` Tom Boyd
2018-10-16 2:07 ` Daniel Shahaf
2018-10-16 9:33 ` Peter Stephenson
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='CAO1rNLg3Y=W8=r6FSOyBLfjcvKmduit6UQGYwrDGKvVEHwOQJg@mail.gmail.com' \
--to=tvboyd23@gmail.com \
--cc=zsh-workers@zsh.org \
/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).