Skip to content

--file with empty file differs in behavior from grep #900

@mqudsi

Description

@mqudsi

What version of ripgrep are you using?

0.8.1

What operating system are you using ripgrep on?

Linux/WSL

Describe your question, feature request, or bug.

From man grep:

-f FILE, --file=FILE
Obtain patterns from FILE, one per line. If this option is used multiple times or is combined with the -e (--regexp) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing.

rg's behavior here is to treat an empty file as matching everything instead:

touch empty.txt
rg -l -f empty.txt
# prints all files

See also #783

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