The old test was relying on the following properties:
* There is a segment containing the ehdr, i.e. whose file offset is 0
* That segment is the first phdr with type `PT_LOAD`; because `PT_LOAD`
segments are sorted on `p_vaddr`, this means its virtual address is
the lowest of all loadable segments
The first assumption, although not standard, is somewhat reasonable, and
the commit prior to this one makes `Elf2` obey it. However, the second
assumption is not based on anything, and to my knowledge the linker is
entirely welcome to lay out the virtual address space as it sees fit.
Therefore, refactor this test to eliminate that bad assumption.
Bug 1: `tryLock` can acquire a lock while another reader still holds
shared access to the lock. This one if fairly easy to reproduce, so the
test always catches it.
Bug 2: Cancelled writer can leave a stale semaphore permit, essentially
leaving the lock in an unusable state. This one is hard to reproduce
deterministically, the test catches it most of the time, but not always.
Let me know if you are OK with probabilistic tests like this, or I
should remove them.
Fixes https://codeberg.org/ziglang/zig/issues/36217
Fixes https://codeberg.org/ziglang/zig/issues/36178
The API for std.lang.Type changed in PR #35234, but the ASN.1 tag
encoder is using the old API. Update the check for an exhaustive enum
for the new API, and add a test that exercises this prong of the
encoder.
partial revert of 8e48a5c524
partial revert of 8380531aec
fixes regression in the build system causing crash when trying to build
ffmpeg project from the ecosystem.
upon closer inspection, I don't think this is the right direction for
adding this data to Configuration. Let's try again and be a little more
careful about it.
Previously, the code relied on being able to write an entire match at once. When combined with limited streaming, this could result in an infinite loop with e.g. streamExact.
The fix here is to support writing partial matches up to the limit, and then continue writing the rest of the match on the next stream.
Fixes https://github.com/ziglang/zig/issues/25032
followups from 8e48a5c524 along with
other related changes.
- user input options should not be serialized into Configuration.
- more helpful log messages when invalid -D arguments are provided
- use array hash maps in various places, simplifying iteration and
sorting.
- when creating a package instance, sort the user input options once,
before the lookup, rather than creating a fresh hash map and sorting
it on every call to hash (wtf!)
- when sorting, don't use ascii case insensitivity (wtf!!)
- simplify the detection of invalid arguments passed to zig build
- use package hash rather than file system path in package instance key
including when using `--watch`.
This is done by adding an extra auto-generated placeholder Step at the
end of `Maker.steps` that contains the file system inputs for the
configurer. It is done this way so that the hot path of file system
watching does not need to make any special cases, and to avoid more
OS-specific logic in file system watching implementation.
closes#20602closes#35460
Currently std.zon.stringify.serialize always escapes Unicode characters, while std.json.stringify by default does not. This change adds an escape_non_ascii option that matches the JSON serializer's behavior.
`escape_non_ascii` is false by default, and will only escape unicode once set to true.
Closes [#23535](https://github.com/ziglang/zig/issues/23535)
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30710
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
When `std.Io.Condition` is signaled and almost immediately after
that canceled, it will swallow the `error.Canceled` error and
leave the task in an uncancelable state.
Co-authored-by: Lukas Lalinsky <lukas@lalinsky.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35564
Reviewed-by: mlugg <mlugg@mlugg.co.uk>
Mostly I did this to test sendTimeout with something other than my
own code.
Now that send is Operation-based, it can also honor the timeout
deadlines lookupDns is already enforcing on the receive side
(which may matter if the socket output buffer gets filled - sends
are not always immediately-successful!).
Also adds sendTimeout() and sendManyTimeout() functions to
Io.net.Socket, and updates the UDP tests to exercise all of the
combined interfaces.
Deprecates `sendMany` in favor of `sendManyTimeout` with a
`Timeout` of `.none`. The existing `sendMany` interface is not
capable of reporting partial success, and eventually removing it
will align with the current interfaces on the receive side.
Seems to work for Posix + Threaded? Beyond very basic "avoid
compile errors maybe", I have not tried to address non-Posix or
non-Threaded parts.
On include/uapi/linux/close_range.h of the linux src tree,
The C equivalents for the CLOSE_RANGE members are defined like this:
-
/* Unshare the file descriptor table before closing file descriptors. */
#define CLOSE_RANGE_UNSHARE(1U << 1)
/* Set the FD_CLOEXEC bit instead of closing the file descriptor. */
#define CLOSE_RANGE_CLOEXEC(1U << 2)
-
Originally, the zig fields of CLOSE_RANGE were offset by one bit-shift
to the right.
This adds one bit of padding which pushes the Zig members by one
bit-shift to the left, making the Zig struct be aligned with
the linux definitions.