You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(win): meson DirectoryLock crashes on fresh build dir #114
After fixing #111 and #113, the next Windows build failure is a Meson upstream crash:
[WASM] Configuring meson (mode: quick)...
Traceback (most recent call last):
File "...mesonbuild\msetup.py", line 191, in generate
with mesonlib.DirectoryLock(self.build_dir, 'meson-private/meson.lock', FAIL, ...):
File "...mesonbuild\utils\win32.py", line 34, in __enter__
msvcrt.locking(self.lockfile.fileno(), mode, 1)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'fileno'
Cause
Meson 1.9.1's DirectoryLock.__enter__ on Windows tries to open(<build_dir>/meson-private/meson.lock, 'w+') before meson has created the meson-private directory. The open() raises an OSError that the except OSError branch silently swallows (it only re-raises FileNotFoundError/IsADirectoryError), leaving self.lockfile = None. Then msvcrt.locking(self.lockfile.fileno(), ...) crashes.
This is a Meson upstream bug, but we can avoid it by pre-creating the directory so the open() succeeds.
Fix
In crates/fastled-cli/src/wasm_build.rs, add fs::create_dir_all(build_dir.join("meson-private"))?; before invoking meson setup. Repro: fastled --just-compile --quick against any sketch on Windows with a fresh .build/ directory.
Root cause clarified — the meson DirectoryLock crash is triggered by us passing the canonicalized Windows long-path form (\?\C:\...) as the build_dir argument to meson.
Python on Windows can't open() a file whose path uses the \?\ prefix from canonicalized paths before handing them to meson (and any other external Python tool). Done by adding strip_windows_unc_prefixtonormalize_pathinwasm_build.rs`.
Resolved by merged PR #118 (e008ca3e). Current origin/main routes wasm_build::normalize_path through crate::path::canonicalize_normalized, which strips Windows \\?\ long-path prefixes before paths are handed to Meson/Python tools.
Activity
zackees commentedon May 31, 2026
Root cause clarified — the meson
DirectoryLockcrash is triggered by us passing the canonicalized Windows long-path form (\?\C:\...) as the build_dir argument to meson.Python on Windows can't
open()a file whose path uses the\?\ prefix from canonicalized paths before handing them to meson (and any other external Python tool). Done by addingstrip_windows_unc_prefixtonormalize_pathinwasm_build.rs`.zackees commentedon Jun 2, 2026
Resolved by merged PR #118 (
e008ca3e). Currentorigin/mainrouteswasm_build::normalize_paththroughcrate::path::canonicalize_normalized, which strips Windows\\?\long-path prefixes before paths are handed to Meson/Python tools.