fd icon indicating copy to clipboard operation
fd copied to clipboard

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

Open nemonein opened this issue 10 months ago • 1 comments

Checks

  • [x] 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 avatar Feb 01 '25 14:02 nemonein

Reported upstream: https://github.com/BurntSushi/ripgrep/issues/2990

tavianator avatar Feb 14 '25 17:02 tavianator

This should be fixed by #1813.

tmccombs avatar Oct 31 '25 06:10 tmccombs