Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 2.46 KB

File metadata and controls

38 lines (29 loc) · 2.46 KB

← Back to Backlog

[SC-025] ✅ DONE - Apply automount metadata and umask defaults in per-distro wsl.conf

Status: Done (2026-03-24) Priority: Medium Component: lib/wsl/docker.ps1, lib/wsl/podman.ps1

Summary: As a WSL user setting up Docker or Podman, I want /etc/wsl.conf to include [automount] options = "metadata,umask=022" so that Windows-mounted drives have sensible Linux file permissions instead of 0777.

Description: By default, WSL2 mounts Windows drives (/mnt/c, etc.) without the metadata flag. This means:

  • All files appear as 0777 (rwxrwxrwx) — no permission differentiation
  • chmod/chown have no effect on Windows-mounted files
  • git inside WSL sees every file as executable, causing noisy diffs
  • DevPod and similar tools that bridge Windows and WSL filesystems are affected

Adding metadata enables Linux permission metadata on DrvFs mounts. Adding umask=022 sets the standard Linux default (files=644, dirs=755). This was discovered during research into DevPod + Docker/Podman compatibility.

The setting belongs in /etc/wsl.conf (per-distro), not .wslconfig (global). The existing Set-WslConf function already supports merging arbitrary sections, so the implementation is straightforward: add an automount section to the $sections hashtable in both Install-WslDocker and Install-WslPodman.

Acceptance Criteria:

  • Install-WslDocker adds [automount] options = "metadata,umask=022" to wsl.conf when not already present
  • Install-WslPodman adds [automount] options = "metadata,umask=022" to wsl.conf when not already present
  • Existing user-defined [automount] options are preserved (not overwritten)
  • Unit tests cover the new automount section in both docker and podman flows
  • All existing tests continue to pass
  • Extract Set-WslConf, Test-WslSystemdConfigured, Test-WslInteropConfigured, Test-WslAutomountConfigured from user.ps1 into dedicated wsl-conf.ps1
  • Tests for extracted functions moved to wsl-conf.Tests.ps1

Technical Notes:

  • Wire into the existing $sections hashtable pattern in both Install-WslDocker (~line 190) and Install-WslPodman (~line 201)
  • Set-WslConf already handles section merging and key-level idempotency
  • The options key value must be quoted: "metadata,umask=022"
  • Consider whether a Test-WslAutomountConfigured check function is needed (similar to Test-WslSystemdConfigured)

← Back to Backlog