-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
This issue is somewhat releated to #5445 and #10084 but applies to more generic version of reported issues.
In general on NTFS and on FAT file systems executable permissions are not avialable by default resulting in all files being executable. What I noticed is that the problem is not as simple as avoiding checking this rule on windows / wsl etc. as NTFS and FAT system may also be used for drives which are shared between Windows and Linux OS.
In my case, I have an exFAT drive shared between Windows 11 and Ubuntu 24.04 and all files appear as executable. When I am running ruff on Ubuntu 24.04 EXE002 is triggered.
-rwxr-xr-x 1 argmaster argmaster 2543 Aug 16 19:53 conftest.py
drwxr-xr-x 3 argmaster argmaster 131072 Aug 16 20:29 examples
drwxr-xr-x 11 argmaster argmaster 131072 Aug 16 19:56 gerberx3
-rwxr-xr-x 1 argmaster argmaster 35 Aug 16 19:53 .gitignoreHence I would recommend adding some additional heuristic to detect if filesystem used supports executable permissions. This should only be needed on Unix family of operating systems.
Simple, although not perfect way to detect if file system supports executable bit could be to create temporary file next to a python file we are checking and make an attempt to toggle executable bit on it. Handling symlinks could get tricky though. I am not knowledgable enough to suggest better solution unfortunately.
Python 3.12.0
ruff 0.5.1