From: Philippe Troin <phil@fifi.org>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] respect nullglob given multios
Date: Thu, 10 Oct 2019 17:25:32 -0700 [thread overview]
Message-ID: <8915ded7b3350db47105804659b99b2c3e07cf45.camel@fifi.org> (raw)
In-Reply-To: <1570725646.5885.4.camel@samsung.com>
On Thu, 2019-10-10 at 16:40 +0000, Peter Stephenson wrote:
> On Thu, 2019-10-10 at 01:18 +0000, Joe Rice wrote:
> > This patch makes multios behave less surprisingly with nullglob.
> >
> > Currently, multios throws a file not found error when a nullglob is
> > given. This patch inserts /dev/null into the redirection list when
> > the
> > glob returns empty with no errors.
> >
> > Is this a behavior that would interest anyone else? I find myself
> > using the `cat /dev/null *(N.)` idiom quite a bit and I thought the
> > behavior made sense for the null case in multios.
>
> This does seem a logical effect, though it ought to be documented.
I am not sure if it's that logical.
What about if the pipeline on left of the redirection is something
expensive?
I'd rather have the command fail than starting a long-running job whose
output will be lost.
Also, conceptually, this introduces a difference between the behaviors
of an explicitly empty redirection and an empty redirection after
filename expansion.
Compare:
% zsh -f
% echo $ZSH_VERSION
5.7.1
% print nosuchfileprefix*(N)
% print
% print > nosuchfileprefix*(N) # Implicitly sends to /dev/null
% print >
zsh: parse error near `\n'
%
I'd argue that the behavior should be the same: both should send to
/dev/null or not.
Incidentally, and as a completely separate issue, on an unpatched 5.7.1
zsh (Fedora 30 stock package), the command above succeeds and creates a
file:
% print > nosuchfileprefix*(N)
% ls nosuchfileprefix*(N)
'nosuchfileprefix'$'\207\210''N'$'\212'
Is that expected?
Phil.
next prev parent reply other threads:[~2019-10-11 0:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191010011901epcas4p3219be0dd0e02bc7168787305e4e1dcf6@epcas4p3.samsung.com>
2019-10-10 1:18 ` Joe Rice
2019-10-10 16:40 ` Peter Stephenson
2019-10-11 0:25 ` Philippe Troin [this message]
2019-10-11 6:46 ` Joe Rice
2019-10-11 8: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=8915ded7b3350db47105804659b99b2c3e07cf45.camel@fifi.org \
--to=phil@fifi.org \
--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).