Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: probabilistic inconsistent cache state on Windows (repeatedly AccessDenied) from modifying build.zig during running zig build runcmiti #18459

Open
matu3ba opened this issue Jan 5, 2024 · 3 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@matu3ba
Copy link
Contributor

matu3ba commented Jan 5, 2024

Zig Version

0.12.0-dev.2046+d3a163f86
Windows 10.0.19045 (has POSIX file operations support) [latest Windows 10]

Steps to Reproduce and Observed Behavior

git clone https://github.com/matu3ba/win32k-mitigation
cd win32k-mitigation
git checkout ae39165edc07f79783874b0680387a1d578c2c65

Ca. 20-30% trigger chance to get into state, where "zig build runcmiti" fails deterministically and every time. I have edited the file usually after 0.75s and saving takes ~1s due to ?zig.vim on windows shennanigans? (where it asks for key to press).

diff --git a/build.zig b/build.zig
index 0594aae..1dfc7c4 100644
--- a/build.zig
+++ b/build.zig
@@ -124,7 +124,7 @@ pub fn build(b: *std.Build) void {
         // 5. Observe deterministically
         // $ zig build runcmiti
         // error: failed to rename compilation results ('C:\Users\user\dev\zi\win32k-mitigation\zig-cache\tmp\15adb3c4a03dd078') into local cache ('C:\Users\user\dev\zi\win32k-mitigation\zig-cache\o\0df9a39edc521d2b17c1fd98d3777908'): AccessDenied
-        run_win32k_mitigation_c_test.expectExitCode(1);
+        run_win32k_mitigation_c_test.expectExitCode(0);
 
         run_step_cmiti.dependOn(&run_win32k_mitigation_c_test.step);
     }
# powershell
rm -fo -r .\zig-cache\
rm -fo -r .\zig-out\
zig build runcmiti
git apply --ignore-whitespace b.diff
zig build runcmiti

Result in 20-30% of cases repeatedly infinitely (sometimes it did recover):

$ zig build runcmiti
error: failed to rename compilation results ('C:\Users\user\dev\zi\win32k-mitigation\zig-cache\tmp\15adb3c4a03dd078') into local cache ('C:\Users\user\dev\zi\win32k-mitigation\zig-cache\o\0df9a39edc521d2b17c1fd98d3777908'): AccessDenied

Expected Behavior

No repeatedly AccessDenied from zig build runcmiti.

@matu3ba matu3ba added the bug Observed behavior contradicts documented or intended behavior label Jan 5, 2024
@matu3ba matu3ba changed the title build: probabilistic inconsistent cache state on Windows (repeatedly AccessDenied) from renaming build.zig during running zig build runcmiti build: probabilistic inconsistent cache state on Windows (repeatedly AccessDenied) from modifying build.zig during running zig build runcmiti Jan 5, 2024
@matu3ba
Copy link
Contributor Author

matu3ba commented Jan 5, 2024

Possibly solved by fixing #18450.

@ndbn
Copy link
Contributor

ndbn commented Jan 24, 2024

@matu3ba please recheck with >= 0.12.0-dev.2330

@ypsvlq
Copy link
Contributor

ypsvlq commented Jan 27, 2024

fixed by #18637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants