Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Documentation about Multios is misleading, and perhaps untrue
- X-seq: zsh-workers 43671
- From: Tom Boyd <tvboyd23@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Documentation about Multios is misleading, and perhaps untrue
- Date: Wed, 10 Oct 2018 22:33:15 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=QxviaKIJU46DTmC1hut+NucfSoEbaqAQVxmgMpWatv4=; b=K0FwvDTfapM6nSM6/LqO8heLRspDtQP3YiIDfJ8NJRnrsmA8bk/vG5hvZK9lsjPtro bu+JTqDDNBeMrQSNCjDxOz2735fTAG3V7FAaxm2vzk6fbLKzEXTZqeSbC5TgfDavRroj RWRuwLQokIBVzSej/xoTpli8OaNtIBuzlX6B/H0Wp7+J8/r6b+VnNquZW9J0fJWI7B9P CnRR8iv+14AkKk39RD2GPk9O/VSYBQHl17GAIEUJcj5UOI3TrztLOIjA/yNhTYYvCpWh cWTUlbgyMBTJMPWFlCKNV03NNDBoHKJ3J+PA93Wzrnv0dOUaxs5xmDEMq1uD2Wr0Sl53 pVTg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author