ajeetdsouza/zoxide

Zoxide "zi" hangs when mount point is in list (/mnt) that's unavailable

samsnori opened this issue · 1 comments

Since a couple of weeks I've noticed that when I try to move into a directory using zi that it takes a very long time before zi finishes and moves into the directory. As I mainly use joshuto as my file manager I thought this was an issue with joshuto but it's zoxide. Or, rather is probably my filesystem.

When I run strace zoxide query -i and I try to move into a directory I see:

--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2920156, si_uid=1000, si_status=0, si_utime=5 /* 0.05 s */, si_stime=4 /* 0.04 s */} ---
statx(AT_FDCWD, "/mnt/windows/project", AT_STATX_SYNC_AS_STAT, STATX_ALL

This is where it seems to hang. After ~10-20 seconds the command finishes and I've entered the directory.

I have added this to my .bashrc to prevent my /mnt dir from being indexed:

export _ZO_EXCLUDE_DIRS=/mnt/*

Then I started to remove the /mnt/<dir> entries which are currently already in my database. However when I run the following command it seems that it doesn't remove the files from the database. When I run zoxide query -i I can still see the just removed entries.

zoxide remove /mnt/<somedir>

How can I cleanup my database so that all /mnt entries are removed?
Is there an solution where I can ask to remove everything that starts with /mnt/ ?
...and is there another solution where I can keep /mnt in my database but prevent the stall of 10-20 sec?

Added a fix that will lazily remove excluded directories when querying them. This will be released with zoxide 0.9.5.