Compare commits

...

3 Commits

Author SHA1 Message Date
bfredl
3aa935bc0f
Merge d1bf035017 into f845fa04a0 2024-11-21 00:29:45 +01:00
Alex Rønne Petersen
f845fa04a0 std.debug: Gracefully handle process_vm_readv() EPERM in MemoryAccessor.read().
Closes #21815.
2024-11-20 23:07:46 +01:00
bfredl
d1bf035017 build: retry when nested lazy dependency causes missing artifact
Consider root build.zig having a mandatory dependency on package A which
in turns has a lazy dependency on package B.

When the root build.zig calls

    const artifact = dep_a.artifact("a_artifact");

This might cause an error, as package B needs to be fetched before the
artifact can be built. However, the hard panic in Dependency.artifact()
is seen as a fatal error which _prevents_ the parent `zig build` process
from fetching missing dependencies and trying once more.

Handle this more gracefully by checking if we already know there were
missing lazy dependencies, which might come from package A. In the case
we still reach a fixed point with a missing artifact, panic as before.
2024-09-24 10:05:37 +02:00
2 changed files with 6 additions and 1 deletions

View File

@ -1982,6 +1982,10 @@ pub const Dependency = struct {
}
}
return found orelse {
if (d.builder.graph.needed_lazy_dependencies.entries.len != 0) {
// The artifact might become available after missing lazy dependencies have been resolved.
process.exit(3);
}
for (d.builder.install_tls.step.dependencies.items) |dep_step| {
const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
log.info("available artifact: '{s}'", .{inst.artifact.name});

View File

@ -48,7 +48,8 @@ fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool {
switch (linux.E.init(bytes_read)) {
.SUCCESS => return bytes_read == buf.len,
.FAULT => return false,
.INVAL, .PERM, .SRCH => unreachable, // own pid is always valid
.INVAL, .SRCH => unreachable, // own pid is always valid
.PERM => {}, // Known to happen in containers.
.NOMEM => {},
.NOSYS => {}, // QEMU is known not to implement this syscall.
else => unreachable, // unexpected