PHANTOM
🇮🇳 IN
Skip to content

[BUG] The 'pattern contains path separator' error is only shown when pattern is an existing directory #1873

@greenwastaken

Description

@greenwastaken

Checks

  • I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

If invoked with fd /, fd fails with the following error

[fd error]: The search pattern '/' contains a path-separation character ('/') and will not lead to any search results.

If you want to search for all files inside the 'Programs/' directory, use a match-all pattern:

  fd . '/'

Instead, if you want your pattern to match the full file path, use:

  fd --full-path '/'

However, this behavior is inconsistent. The error message is only printed when the pattern also happens to be an existing directory. Otherwise, fd returns no error, and silently finds no files.

Describe what you expected to happen:

I would expect the error about how a pattern with a '/' in it will not lead to any search results to be displayed regardless of the pattern possibly being a directory path.

What version of fd are you using?

fd 10.3.0

Which operating system / distribution are you on?

Linux 6.18.4-arch1-1 x86_64

LSB Version:    n/a
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions