[v2] wailsjs file modes differ between `wails generate module` and `wails build`/`wails dev` — spurious git mode changes
Description
The same generated files get different permission bits depending on which command ran last:
wails generate module→ everything underwailsjs/becomes 0755 (including.js,.d.ts,.json)wails build/wails dev→wailsjs/runtime/*ends up 0644, whilewailsjs/go/*stays 0755
For projects that commit wailsjs (the shipped templates include it), this produces diffs with a mode change and zero content change, in both directions:
mode change 100644 => 100755 frontend/wailsjs/runtime/runtime.js (after `wails generate module`)
mode change 100755 => 100644 frontend/wailsjs/runtime/runtime.js (after `wails build`)So no committed mode satisfies both commands — whichever one you commit, the other dirties the tree. The files are byte-identical; Windows is unaffected (git does not track the exec bit there).
Root cause, as far as I can trace it: two paths extract wailsjs/runtime/, and only the first is followed by a permission fixup.
- Binding generation —
v2/internal/app/app_bindings.go#L104-L123: remove + gosod extract +fs.SetPermissions(wailsjsbasedir, 0755).fs.SetPermissions(v2/internal/fs/fs.go#L272-L279) isfilepath.Walk+os.Chmodwithout distinguishing files from directories, so regular files get the exec bit too. That comes from #1763 — not arguing it is wrong, just identifying the source of 0755. - Build / dev —
generateRuntimeWrapper(v2/pkg/commands/build/base.go#L428-L445, called at#L158fromCompileProject): remove + gosod extract, which writes viaos.Create→ 0644, and nothing re-applies 0755 afterwards. It runs after the chmod above, which is why onlyruntime/flips back to 0644.
That also decides the fix, and it's your call:
- 0755 canonical (per #1763) → apply the same permission step after
generateRuntimeWrapper, or drop the redundant re-extract. - 0644 canonical → change
SetPermissionsso it only fixes up directories.
Happy to send a PR for either direction.
To Reproduce
wails init -n modecheck -t vanilla-ts && cd modecheck
stat -c '%a %n' frontend/wailsjs/runtime/* frontend/wailsjs/go/main/* # all 644
wails generate module -tags webkit2_41
stat -c '%a %n' frontend/wailsjs/runtime/* frontend/wailsjs/go/main/* # all 755
wails build -s -tags webkit2_41
stat -c '%a %n' frontend/wailsjs/runtime/* frontend/wailsjs/go/main/* # runtime 644, go 755
wails generate module -tags webkit2_41
# runtime/* 755 again — flipping on every alternation| step | wailsjs/runtime/* |
wailsjs/go/* |
|---|---|---|
wails init |
644 | 644 |
wails generate module |
755 | 755 |
wails build / wails dev |
644 | 755 |
wails generate module again |
755 | 755 |
Note the first row: wails init writes everything 0644, so the very first wails generate module already turns a clean tree into five mode change 100644 => 100755 entries.
Expected behaviour
Both entry points leave the same permissions, so regenerating bindings is a no-op on a clean tree.
Screenshots
No response
Attempted Fixes
- Searched the issue tracker, PRs and discussions for an existing report — no duplicate found.
- Traced both code paths myself and confirmed the ordering with a minimal
wails initproject (no git needed, juststat). - Local workaround only:
git config --local core.fileMode false— hides the diffs, does not fix the inconsistency. - Considered sending a patch directly, but the intended direction (unify on 0755 vs 0644) is ambiguous because #1763 added the 0755 fixup deliberately, hence this ticket first.
System Details
Wails Doctor
# Wails
Version | v2.12.0
Package Manager | apt
# System
┌───────────────────────────────────────────────────────────┐
| OS | Ubuntu |
| Version | 24.04 |
| ID | ubuntu |
| Branding | |
| Go Version | go1.24.11 |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 7 8845HS w/ Radeon 780M Graphics |
| Memory | 16GB |
└───────────────────────────────────────────────────────────┘
# Dependencies
┌───────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status | Version |
| *docker | docker.io | Installed | |
| gcc | build-essential | Installed | 12.10ubuntu1 |
| libgtk-3 | libgtk-3-dev | Installed | 3.24.41-4ubuntu1.3 |
| libwebkit | Unknown | Not Found | |
| npm | npm | Installed | 9.2.0~ds1-2 |
| *nsis | nsis | Available | 3.09-4ubuntu1 |
| pkg-config | pkg-config | Installed | 1.8.1-2build1 |
| |
└─────────────────── * - Optional Dependency ───────────────────┘
# Diagnosis
Optional package(s) installation details:
- nsis: sudo apt install nsis
WARNING Your system has missing dependencies!
Fatal:
Required dependencies missing: libwebkitAdditional context
- Related but distinct: #2367 (runtime dir rewritten on every dev build), #2372 (closed attempt to stop rewriting it).
wails buildis what I ran;wails devwas not run (it starts a GUI), but it goes through the samebuild.Buildpath.- The
libwebkit: Not Foundwarning is the webkitgtk 4.0 vs 4.1 mismatch — this box only has webkit2gtk-4.1 (2.52.6), and builds were made with-tags webkit2_41and succeed.
Source: wailsapp/wails