1

fd-find does not finding anything. When searching something in home directory it instantly exists without any error.

❯ mkdir root

❯ cd root

❯ touch test

❯ ls -l
total 0
-rw-rw-r-- 1 s1n7ax s1n7ax 0 Jul  6 21:29 test

❯ which fd
/home/s1n7ax/.cargo/bin/fd

❯ fd --version
fd 8.7.0

❯ fd test

❯ fd -t f test

I tried installing the same binary using apt package manages as well. it installs 8.3.1 version and binary name changes to fdfind yet no results

s1n7ax
  • 387
  • 3
  • 12
  • 2
    Possibly your `~/.config/fd/ignore` or `~/.gitconfig` or `~/.config/git/config` ignoring too many things? – Stéphane Chazelas Jul 06 '23 at 16:24
  • Is it the same with `XDG_CONFIG_HOME=/dev/null HOME=/dev/null fd test`? – Stéphane Chazelas Jul 06 '23 at 16:27
  • Oh, looks like it looks in many more conf files than that. Check with `strace -ze file fd test` to see what it finds that may have exclude patterns, that could also be in `.gitignore` files or other in any of the ancestor directories. – Stéphane Chazelas Jul 06 '23 at 16:29
  • @StéphaneChazelas It was the .gitignore. My home directory is a repository and I'm ignoring everything that does not starts with a . (dot). So yeah – s1n7ax Jul 06 '23 at 16:42

1 Answers1

3

Unless passed the -I option, fdfind ignores the same files git ignores and more by looking into the same files as git looks into plus a few of its own.

Quoting the description of the -I option from its man page on Debian:

-I, --no-ignore
Show search results from files and directories that would otherwise be ignored by

  • .gitignore
  • .git/info/exclude
  • The global gitignore configuration (by default $HOME/.config/git/ignore)
  • .ignore
  • .fdignore
  • The global fd ignore file (usually $HOME/.config/fd/ignore)

The flag can be overridden with '--ignore'.

To see which of those conf files (and possibly more) fdfind finds, you can run it as:

strace -ze file fdfind test

Where strace will report the successful (-z) file-related system calls fdfind makes where you might see it open a .gitignore file in the parent directory or parent's parent or some other file that specifies patterns of files or directories to ignore in a gitignore fashion.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501