zsh-users
 help / color / mirror / code / Atom feed
From: Matt Wozniski <godlygeek@gmail.com>
To: zsh-users@zsh.org
Subject: Re: possible bug in zsh glob
Date: Wed, 24 Feb 2010 10:38:06 -0500	[thread overview]
Message-ID: <17393e3e1002240738p2fd4006aud1183c0229ce10f1@mail.gmail.com> (raw)
In-Reply-To: <20100224075352.GA8456@fermat.math.technion.ac.il>

On Wed, Feb 24, 2010 at 2:53 AM, Nadav Har'El <nyh@math.technion.ac.il> wrote:
> On Tue, Feb 23, 2010, Andrey Borzenkov wrote about "Re: possible bug in zsh glob":
>> On Tuesday 23 of February 2010 19:13:02 dipakgaigole wrote:
>> > *************** bash **************
>> > bash-2.05b$ ls -l *.txt *.jp
>> > ls: *.jp: No such file or directory
>> [...]
>> > #ls -l *.txt *.jp
>> > zsh: no matches found: *.jp
>>
>> setopt no_nomatch
>>
>> to get the same behaviour as in bash.
>
> Amazing! This really surprised me. I was about to answer that, "no, zsh
> behaves exactly like bash in this respect, and the way it should", when I
> suddenly realized that many years ago I added "set +o nomatch" (equivalent
> to setopt no_nomatch you recommended) in my .zshrc, and since forgot about
> it :-)
>
> Is there any logical reason why zsh's default is the way it is? I.e., when
> it sees
>
>        ls -l *.txt *.jp
>
> And there are no *.jp, it has to stop the entire command, rather than let
> the command give you a message, like was always the case in the Bourne shell,
> ksh, and bash (without the failglob option)?
>
> I always consider what is now apparently the default zsh behavior to be
> annoying especially when you do a command like
>
>        scp remote:*.c .
>
> and then the shell doesn't do it, and you need to go back and quote out the
> star. Why? What does this extra "beaurocracy" gain us? If the shell can
> just do "the right thing" by passing along the star, why shouldn't it?

Because the sh/ksh/default bash behavior is dangerous if you ever have
filenames containing shell metacharacters.  Consider a command like:

    rm [abc]

The sh/ksh/default bash behavior would be for that to delete any file
named either 'a', or 'b', or 'c', or, if there are no files with any
of those names, to delete the file named '[abc]'.  I, quite frankly,
find that nuts.  Not that the zsh behavior can't be annoying at times
- I'd prefer nonomatch for scp wildcards, for instance - but at least
the zsh behavior is safe.  It does what you tell it to, and aborts if
it can't.  The other shells do what you tell them to, but assume that
you told them to do the wrong thing if they can't.

~Matt


  parent reply	other threads:[~2010-02-24 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 16:13 dipakgaigole
2010-02-23 16:26 ` Mikael Magnusson
2010-02-23 17:20 ` Andrey Borzenkov
2010-02-24  7:53   ` Nadav Har'El
2010-02-24  8:10     ` Andrey Borzenkov
2010-02-24 15:38     ` Matt Wozniski [this message]
2010-02-24 10:56 dipakgaigole
2010-02-24 15:00 ` ( Text in unknown character set UTF-8 not shown ) Bart Schaefer
2010-02-24 16:17   ` possible bug in zsh glob Bart Schaefer

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=17393e3e1002240738p2fd4006aud1183c0229ce10f1@mail.gmail.com \
    --to=godlygeek@gmail.com \
    --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).