Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[BUG] --exclude does not work when directory's name ends with dot(.). #1667

Open
1 task done
nemonein opened this issue Feb 1, 2025 · 1 comment
Open
1 task done

Comments

@nemonein
Copy link

nemonein commented Feb 1, 2025

Checks

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

Describe the bug you encountered:

Hello.
I'm on Archlinux, using fd 10.2.0 and zsh.

If a directory's name ends with .(dot), and if the directory is being excluded by --exclude, fd does not do the job.
For example,

$ ls -l
drwxr-xr-x 1 nemo nemo 1.2K 2025-02-01 22:41  abcfoobar.
drwxr-xr-x 1 nemo nemo 1.2K 2025-02-01 22:44  abcfoobarzoo
drwxr-xr-x 1 nemo nemo  184 2025-02-01 23:18  xyzbarfoo
.... (many other dirs...)

I have a directory named abcfoobar., abcfoobarzoo, and xyzbarfoo.

$ fd --exclude=abcfoobar. --exclude=xyzbarfoo | rg 'abcfoobar|xyzbarfoo'
1:1:abcfoobarzoo/
2:1:abcfoobar./
3:1:abcfoobar./fd_file_practice_deleteit
4:1:abcfoobar./2-chrome-kjbdgfilnfhdoflbpgamdcdgpehopbep-Default.desktop
5:1:abcfoobar./2-chrome-kdhdkmeileofnlbnpndjkbgiemlhgmmd-Default.desktop
6:1:abcfoobar./2-chrome-jgcngmnmmbofobnpbddpeedpiaiogpdh-Default.desktop
7:1:abcfoobar./2-chrome-famcjndkpfkjbdmdjokfbokncecponlc-Default.desktop
8:1:abcfoobar./2-chrome-eilembjdkfgodjkcjnpgpaenohkicgjd-Default.desktop
9:1:abcfoobar./2-chrome-cgjkcjhllhgpdlnpdlfoollgddkoopgn-Default.desktop
10:1:abcfoobar./2-chrome-agimnkijcaahngcdmfeangaknmldooml-Default.desktop
11:1:abcfoobar./2-chrome-abhlffefmlmfknmhmpkbnekffhfphmjn-Default.desktop
12:1:abcfoobar./2-albert-windows-rule3.kwinrule
13:1:abcfoobar./2-albert-windows-rule2.kwinrule
14:1:abcfoobar./2-albert-windows-rule.kwinrule

To make it work, I have to try something else.

$ fd --exclude='abcfoobar.*' --exclude=xyzbarfoo | rg 'abcfoobar|xyzbarfoo'
1:1:abcfoobarzoo/

'abcfoobar.*' is not regex, because it does not exclude 'abcfoobarzoo'.


Is is as intended?
If so, please describe this on the README.
Also, on the README, the example is not a good one.

> fd -E /mnt/external-drive …

However, --exclude is relative to the starting directory, said @tavianator.
This also has to be mentioned on the README.

Describe what you expected to happen:

No response

What version of fd are you using?

10.2.0

Which operating system / distribution are you on?

Linux 6.12.10-arch1-1 x86_64
Archlinux, KDE Plasma6, with zsh.
@nemonein nemonein added the bug label Feb 1, 2025
@tavianator
Copy link
Collaborator

Reported upstream: BurntSushi/ripgrep#2990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants