Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

glob / wildcard matching issue #318

Closed
muesli opened this issue Feb 2, 2017 · 2 comments
Closed

glob / wildcard matching issue #318

muesli opened this issue Feb 2, 2017 · 2 comments

Comments

@muesli
Copy link
Contributor

muesli commented Feb 2, 2017

  $ touch a                                                                                                                                                                           
  $ touch b                                                                                                                                                                           
  $ touch c                                                                                                                                                                           

  $ ls -l                                                                                                                                                                             
  total 0
  -rw-r--r-- 1 muesli muesli 0 Feb  2 11:40 a
  -rw-r--r-- 1 muesli muesli 0 Feb  2 11:40 b
  -rw-r--r-- 1 muesli muesli 0 Feb  2 11:40 c

  $ ls bar*                                                                                                                                                                           
  a  b  c

As you can see the non-matching 'bar*' glob essentially translates to an empty string and "ls" is executed. This is potentially dangerous.

@xiaq
Copy link
Member

xiaq commented Feb 2, 2017

We can have wildcards that expand to nothing throw an error by default, and add a nothing-ok modifier (cf #298) to suppress this failing behavior.

PS. @muesli to be precise, your bar* did not evaluate to an empty string (that would be ls "") but rather nothing (giving ls no argument at all).

@xiaq xiaq closed this as completed in aa9e246 Feb 2, 2017
@xiaq
Copy link
Member

xiaq commented Feb 2, 2017

Spec for new (just implemented) behavior: https://github.com/elves/elvish/wiki/Language-Specification#wildcards

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants