zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: whence question
Date: Sat, 14 Jan 2017 08:36:21 -0800	[thread overview]
Message-ID: <f010c587-3ac1-e018-74cc-6018b8e7fbe4@eastlink.ca> (raw)
In-Reply-To: <20170114064807.GA31410@fujitsu.shahaf.local2>

On 13/01/17 10:48 PM, Daniel Shahaf wrote:
>
> That's only true when 'setopt nonomatch' is in effect, which is not the
> default.  By default, globs that have no match are considered errors.
> The NULL_GLOB option selects a third mode.  See:
>
>      % cd $(mktemp -d)
>      % echo foo*
>      zsh: no matches found: foo*
>      % (setopt nullglob; echo foo*) | nl -ba
>      
>      % (setopt nonomatch; echo foo*)
>      foo*
>      %
I'll take a closer look at those options, I'm always terrified that if I 
play with them I'll set a landmine what will blow up on me latter and 
I'll forget what it is that I changed or why things are broken.   Gotta 
make sure that nullglob and nonomatch don't trip over each other.  But 
first experiments:



> $ unsetopt nullglob; unsetopt nonomatch; whence -ma grub-r*
> $ unsetopt nullglob; setopt nonomatch; whence -ma grub-r*
> $ setopt nullglob; setopt nonomatch; whence -ma grub-r*
> $ setopt nullglob; unsetopt nonomatch; whence -ma grub-r*

Does that contradict? Nuthin' works.
>> [...] I can see that without 'noglob' the shell's zeal for expanding
>> globs is in more or less direct conflict with the intention of the 'm'
>> switch which supposes that whence will handle globing itself.  I can
>> also see that that might not be fixable even in theory for reasons of
>> consistency,

> Also, the existing design has merits: *every* external and builtin
> command parses "words with globbing metacharacters" the same way.
> «echo *foo» and «whence *foo» and «bar *foo» are all subject to the
> same rules.  The rules are consistent for everybody.  That's a feature.
Well, consistency trumps convenience.  Still I'd argue that my original 
example really is a gotcha, it's not something that would ever (?) be 
anticipated.  Just being devil's advocate here of course but in this 
case does not the 'm' switch in effect 'state' an exception?  That is, 
is it not an explicit request to change the rules vis a vis globing?  
Without 'm' I have no expectation that whence has any special power vis 
a vis globing (globbing?) but with 'm' I expect that it does.  Can we 
have intuitive behaviour and consistency if it was a stated principal 
that 'm' (and any other such devices) are immune to the artifact of the 
local match which is in no way a 'natural' target for whence anyway?  
IOW 'whence -ma grub-r*' should never be anything other than a search 
for natural whence targets and the local match could be seen as an 
error. Delicate tho, maybe not.


  reply	other threads:[~2017-01-14 16:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-14  4:13 Ray Andrews
2017-01-14  5:11 ` Bart Schaefer
2017-01-14  6:09   ` Ray Andrews
     [not found]   ` <7b890e89-d01b-ab5c-32bf-b75bfa8d945c__41234.9168131643$1484374276$gmane$org@eastlink.ca>
2017-01-14  6:48     ` Daniel Shahaf
2017-01-14 16:36       ` Ray Andrews [this message]
2017-01-14 17:11         ` Bart Schaefer
2017-01-14 19:13           ` Ray Andrews
2017-01-14 17:46       ` Jens Elkner
2017-01-14 17:59         ` Bart Schaefer
2017-01-14 18:23           ` Jens Elkner
2017-01-14 19:08         ` Nikolay Aleksandrovich Pavlov (ZyX)
2017-01-14 20:13           ` Daniel Shahaf
2017-01-14 21:04             ` Bart Schaefer
     [not found]             ` <4cca17742cded21984e6092622265ab9@cmgw03.eastlink.ca>
2017-01-14 21:44               ` Ray Andrews
     [not found] <652bcc3f-7365-2e52-d39c-8576278606bc__74.9235078275845$1484367323$gmane$org@eastlink.ca>
2017-01-14  4:40 ` Daniel Shahaf
2017-01-14  4:57   ` Ray Andrews
2017-01-14 18:32     ` Ray Andrews
2017-01-14 18:55       ` Bart Schaefer
2017-01-14 19:51         ` Ray Andrews
2017-01-14 20:56           ` Daniel Shahaf
2017-01-14 21:26             ` Ray Andrews
2017-01-14 21:53               ` Daniel Shahaf
2017-01-15 19:53                 ` Ray Andrews
2017-01-14 21:43             ` Bart Schaefer
2017-01-14 21:55               ` Bart Schaefer
2017-01-15 20:06                 ` Ray Andrews

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=f010c587-3ac1-e018-74cc-6018b8e7fbe4@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@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).