microsoft / microsoft/WSL

Provide a mount option to drvfs to prevent dropping of executable permission via fmask on exe files

Open
#7,933 1 comment 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

By default if a Windows file lacks WSL metadata, its NTFS permissions will be translated to unix permissions^1.
This effectively means all files will be marked as executable which is problematic and ugly (#936).

One can try to workaround by setting fmask=117 on mount point. This will drop executable bit from everything but allow user to put them back using chmod. However such thing will be impossible on system files such as explorer.exe due to lack of permissions.

I propose adding new mount flag, perhaps named nofmaskexe, to disable fmask on files matching *.exe.

This will enable partially emulating the behavior of msys/cygwin which is IMHO what most users expect.

Cygwin-like tools also detect executables by presence of shebang ("#!"), in addition to extension matching but this might be unnecessary here - it's unlikely to have unix style script in system directory.

I would like to see it in both WSL1 and WSL2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how drvfs mount options and fmask are handled in both WSL1 and WSL2. Determine where executable-file permission translation occurs and how a nofmaskexe option would be represented; done means the option prevents fmask from dropping executable permission on .exe files in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.