Commit graph

36542 commits

Author SHA1 Message Date
Andrew Kelley
60e2ea0bfb windows: use ProcessPrng from bcryptprimitives.dll
rather than SystemFunction036 from advapi32. This has the advantage that
the code is loaded preemptively, preventing random numbers from
failing when they are needed for the first time on a system under heavy
load.
2026-01-05 00:36:11 -08:00
Andrew Kelley
36044a0e81 test-standalone: explicitly link to advapi32 sometimes
Now, nearly every object produced by zig has a dependency on
advapi32.dll due to the dependency on RtlGenRandom due to the
implementation of dirCreateFileAtomic which is now analyzed whether or
not it is used.
2026-01-05 00:19:16 -08:00
Andrew Kelley
75f417108c std.Io.Threaded: fix compilation on s390x, hexagon, or1k, m68k
Apparently the O_TMPFILE flag is split across two bits on these
architectures and missing on m68k.
2026-01-04 23:45:17 -08:00
Andrew Kelley
77f6e0690b std.Io.Threaded: only linux supports fileHardLink 2026-01-04 23:45:17 -08:00
Andrew Kelley
c1e9d87b1f compiler: update to new createFileAtomic API 2026-01-04 23:45:17 -08:00
Andrew Kelley
1b6cee8e82 std.Io.Threaded: add File.hardLink 2026-01-04 23:45:17 -08:00
Andrew Kelley
bed0900c8c std.Io.Dir: rework atomic file 2026-01-04 23:45:17 -08:00
Andrew Kelley
8669898819 disable flaky test: aarch64-macos stage3/4 nondeterminism check
tracked by #30687
2026-01-04 23:43:19 -08:00
Andrew Kelley
435cd6f129 Merge pull request 'std.Build: adjust temp files API' (#30683) from std.Build-temp into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30683
2026-01-05 06:02:25 +01:00
Jake Greenfield
8e091047b5 std.Io.Threaded: fix Windows env var mapping
Windows environment variables are case-insensitive, so the special Wtf16
comparison needs to be used, or PATH/PATHEXT might be missed.
2026-01-04 23:32:36 -05:00
Andrew Kelley
c8ecfad41a build runner: clean up tmp dirs 2026-01-04 17:46:44 -08:00
Andrew Kelley
b4dbe483a7 std.Build: adjust temp files API
Remove the RemoveDir step with no replacement. This step had no valid
purpose. Mutating source files? That should be done with
UpdateSourceFiles step. Deleting temporary directories? That required
creating the tmp directories in the configure phase which is broken.
Deleting cached artifacts? That's going to cause problems.

Similarly, remove the `Build.makeTempPath` function. This was used to
create a temporary path in the configure place which, again, is the
wrong place to do it.

Instead, the WriteFile step has been updated with more functionality:

tmp mode: In this mode, the directory will be placed inside "tmp" rather
than "o", and caching will be skipped. During the `make` phase, the step
will always do all the file system operations, and on successful build
completion, the dir will be deleted along with all other tmp
directories. The directory is therefore eligible to be used for
mutations by other steps. `Build.addTempFiles` is introduced to
initialize a WriteFile step with this mode.

mutate mode: The operations will not be performed against a freshly
created directory, but instead act against a temporary directory.
`Build.addMutateFiles` is introduced to initialize a WriteFile step with
this mode.

`Build.tmpPath` is introduced, which is a shortcut for
`Build.addTempFiles` followed by `WriteFile.getDirectory`.

* give Cache a gpa rather than arena because that's what it asks for
2026-01-04 17:23:45 -08:00
Andrew Kelley
e3b7cad81e std.heap.DebugAllocator: disable already flaky test
tracked by #22731

counterpart to ef1ddbe2f0
2026-01-04 07:29:35 -08:00
Andrew Kelley
de25a6ffee Merge pull request 'std: delete os.environ, os.argv, add new parameter to main, move process API to std.Io' (#30644) from juice into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30644
2026-01-04 09:28:33 +01:00
Andrew Kelley
ef1ddbe2f0 std.heap.DebugAllocator: disable already flaky test
tracked by #22731
2026-01-04 00:27:09 -08:00
Andrew Kelley
420a9aed4c build: bump freebsd max_rss
solves error: memory usage peaked at 1.10GB (1102852096 bytes),
exceeding the declared upper bound of 1.06GB (1060217241 bytes)
2026-01-04 00:27:09 -08:00
Andrew Kelley
9eb3b54eb5 std.Io.Threaded: revert making reading fork child status cancelable
this caused the build runner to crash sometimes, not sure why yet
2026-01-04 00:27:09 -08:00
Andrew Kelley
854c076ff7 std.Io.Threaded: improve posix spawning
* avoid unreachable when the OS does something unexpected
* make waiting for the fork/exec error report cancelable
2026-01-04 00:27:09 -08:00
Andrew Kelley
fa315b1060 std.Io.Threaded: improve posix process creation
* cache /dev/null after opening
* make opening /dev/null cancelable
* avoid unreachable even when OS does something unexpected
2026-01-04 00:27:09 -08:00
Andrew Kelley
2c22c3dabf std.Io.Threaded: make processReplace cancelable
In between each attempt to call execve() on a particular file path, it
will check cancelation before trying the next PATH.
2026-01-04 00:27:09 -08:00
Andrew Kelley
08d8b412e9 std.Io.Threaded: more robust windows process creation error handling 2026-01-04 00:27:09 -08:00
Andrew Kelley
f072313e1e std.Io.Threaded: delete dead comment
The problem it talked about is solved now that the direct call to
dirOpenDirWindows makes sense in this context.
2026-01-04 00:27:09 -08:00
Andrew Kelley
0317e95aad std.posix: delete some mkdir functions
These are handled by Io.Dir now. This is part of an effort to eliminate
error.OperationCanceled from the std lib. Also an effort to delete
all std.posix functions.
2026-01-04 00:27:09 -08:00
Andrew Kelley
2b326d27d5 std.Io.Threaded: improve various Windows logic
* cache nul handle for child process execution
* make opening the nul file integrate properly with cancelation
* replace all calls to SleepEx to parking_sleep.sleep instead, making
  them properly cancelable. These sleeps are workarounds for Windows
  kernel bugs. Now you can even cancel while waiting for kernel bug
  workarounds!
2026-01-04 00:27:09 -08:00
Andrew Kelley
be977e1934 std.Io.Threaded: integrate with new cancel mechanism 2026-01-04 00:27:09 -08:00
Andrew Kelley
ff67f70cf9 start: tweak default allocator choices
On wasm targets, when libc is linked, we have to go through libc.
2026-01-04 00:27:09 -08:00
Andrew Kelley
5b9e6a2b2d compiler: fix wasi compilation 2026-01-04 00:27:09 -08:00
Andrew Kelley
e19c686c22 build: bump max_rss for zig
this was exceeded on CI. this value is not meant to be so precisely
tweaked per OS and arch
2026-01-04 00:27:09 -08:00
Andrew Kelley
e23d980e11 std.process.Environ: skip BE createMapWide test coverage
it would be good to fix this but master branch doesn't have coverage
either. one thing at a time.
2026-01-04 00:27:09 -08:00
Andrew Kelley
e2c04a4651 fix some windows compilation errors 2026-01-04 00:27:09 -08:00
Andrew Kelley
2fee64ceb0 update init template for new main API 2026-01-04 00:27:09 -08:00
Andrew Kelley
0b856d12a0 build: remove freebsd max_rss special casing
error: memory usage peaked at 6.05GB (6047436800 bytes), exceeding the
declared upper bound of 6.04GB (6044158771 bytes)

This value isn't meant to be OS-specific anyway.
2026-01-04 00:27:09 -08:00
Andrew Kelley
88dd682155 Compilation: revert bad code transformation
I added `unreachable` in this branch based on a misunderstanding of the
original control flow.
2026-01-04 00:27:09 -08:00
Andrew Kelley
dd7be75f7c std.process: add missing error.OperationUnsupported 2026-01-04 00:27:09 -08:00
Andrew Kelley
e55fa3d525 fix two standalone tests on windows 2026-01-04 00:27:09 -08:00
Andrew Kelley
baa49e5929 std.Io.Threaded: implement processReplace 2026-01-04 00:27:09 -08:00
Andrew Kelley
08cc9e8d59 std.Io.Threaded: std.process -> process 2026-01-04 00:27:09 -08:00
Andrew Kelley
84da158afb test-stack-traces: update to new main API 2026-01-04 00:27:09 -08:00
Andrew Kelley
b32a38ad27 build: fix file system watching compilation on macOS 2026-01-04 00:27:09 -08:00
Andrew Kelley
1070c2a71a rename env_map to environ_map
For naming consistency with `std.process.Environ.Map`.
2026-01-04 00:27:09 -08:00
Andrew Kelley
f25de4c7a2 fix native path lookup on macOS 2026-01-04 00:27:08 -08:00
Andrew Kelley
17c7a339d8 incr-check: update to new APIs 2026-01-04 00:27:08 -08:00
Andrew Kelley
c6b75b61b7 std: fix child processes on riscv32-linux 2026-01-04 00:27:08 -08:00
Andrew Kelley
d97e4ca0d1 documentation should be descriptive not prescriptive 2026-01-04 00:27:08 -08:00
Andrew Kelley
77087f6f31 langref: update to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley
4afed3e9ef test-standalone: update the rest of the cases to new API 2026-01-04 00:27:08 -08:00
Andrew Kelley
e149c0e2aa std.Build.Step.Run: fix wrong environment passed 2026-01-04 00:27:08 -08:00
Andrew Kelley
af164b3f3c std.Build.Step.Run: no need to sort the environment
since we now use ArrayHashMap, the order is deterministic, and in fact,
observable by applications.
2026-01-04 00:27:08 -08:00
Andrew Kelley
ca5c5ade5f std.Options: work around not lazy enough compiler 2026-01-04 00:27:08 -08:00
Andrew Kelley
bf74827ddb test-standalone: update more cases to new main API 2026-01-04 00:27:08 -08:00