Skip to content

Glob [foo is rejected #3127

@martinvonz

Description

@martinvonz

Please tick this box to confirm you have reviewed the above.

  • I have a different issue.

What version of ripgrep are you using?

ripgrep 14.1.1

How did you install ripgrep?

APT

What operating system are you using ripgrep on?

Ubuntu

Describe your bug.

Glob [foo should be interpreted as a literal [foo.

What are the steps to reproduce the behavior?

  1. Run rg -g '[foo' whatever

What is the actual behavior?

$ rg -g '[foo' whatever
rg: error parsing glob '[foo': unclosed character class; missing ']'

What is the expected behavior?

It should return matches of "whatever" in the file called exactly [foo. man glob.7 doesn't seem to mention any invalid patterns. It seems that e.g. find -name '[foo' interprets it that way. Gitignores also do, apparently (this came up in jj-vcs/jj#7259).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn enhancement to the functionality of the software.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions