Open pascalfleury opened 1 year ago
I have exactly the same problem when opening /tmp/user/1000/test
when permissions looks like this
drwx--x--x 3 root root 60 Oct 5 19:33 /tmp/user
drwx------ 2 tcech users 40 Oct 5 19:36 /tmp/user/1000
This is easy to trigger on macOS when you have opened a file in a restricted directory such as iCloud Drive (you can open a specific iCloud Drive file in Emacs, but Emacs can't enumerate the content of the ~/Library/Mobile Documents/com~apple~CloudDocs/Docs
directory).
I am working around this with the following advice:
(defun my-safe-projectile-expand-file-name-wildcard (old-func &rest args)
"Swallow errors and return the same fallback as original function."
(condition-case nil
(apply old-func args)
(file-error (expand-file-name (car args) (cadr args)))))
(advice-add #'projectile-expand-file-name-wildcard :around #'my-safe-projectile-expand-file-name-wildcard)
Context: this happening eg. on TermUX, but I confirmed it on a Linux system when the project is in a directory that is only executable.
Expected behavior
Pressing 's-p f' (
projectile-find-file
) will fail to resolve files.Actual behavior
Should be the same behavior as when there is no file until root, or some fallback when no project file is found.
Steps to reproduce the problem
Create a dir, eg.
/home/$USER/TEMP/hidden/my_projects/
create a file in there, eg./home/$USER/TEMP/hidden/my_projects/config.sh
thenso that one can go into the dir, but
locked
cannot be listed. Then try to useprojectil-find-file
in that dir. It should fail like this:I get the wanted behavior in adding
ignore-errors
in this function:Environment & Version information
Projectile version information
Emacs version
GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.16.0) of 2022-12-02, modified by Debian
Operating system
Linux Debian