public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Eric Joldasov <bratishkaerik@landless-city.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH] zig.eclass: fix rare spurious `error.BrokenPipe` during `src_test`
Date: Mon, 16 Dec 2024 02:54:14 +0500	[thread overview]
Message-ID: <20241215215437.4374-1-bratishkaerik@landless-city.net> (raw)

Most likely caused by `grep -q` processing too fast when steps are
filtered. Can sometimes be reproduced with this command (you might
need several retries to hit it):

```console
$ for i in {0..20}; do zig build --list-steps | grep -q test; done
error: BrokenPipe
/usr/lib64/zig/9999/lib/compiler/build_runner.zig:1229:9: 0x1518f3e in steps__anon_4736 (build)
        try out_stream.print("  {s:<28} {s}\n", .{ name, top_level_step.description });
        ^
/usr/lib64/zig/9999/lib/compiler/build_runner.zig:374:9: 0x1511b81 in main (build)
        return steps(builder, stdout_writer);
        ^
error: the following build command failed with exit code 1:
/home/bratishkaerik/github.com/zig/.zig-cache/o/4b3846557c333ec9e467b7cc136d3698/build /usr/lib64/zig/9999/bin/zig /usr/lib64/zig/9999/lib /home/bratishkaerik/github.com/zig /home/bratishkaerik/github.com/zig/.zig-cache /home/bratishkaerik/.cache/zig --seed 0x86f5c718 -Z7b5e4ad814524daf --list-steps
```

Caught this today when I merged and tested `dev-lang/zig:9999` 9 times
in a row because I was checking patch for upstream. Out of these 9 times
it failed only once. I couldn't reproduce this on `sys-fs/ncdu` or
`gui-wm/river::guru`, my guess here is that `test` step is listed last
there, so zig pipe catches up with it.

(GitHub PR https://www.github.com/gentoo/gentoo/pull/39723)

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
---
 eclass/zig.eclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eclass/zig.eclass b/eclass/zig.eclass
index e838616ef72a..2a0178e66d71 100644
--- a/eclass/zig.eclass
+++ b/eclass/zig.eclass
@@ -520,9 +520,10 @@ zig_src_test() {
 	# by whitespaces is not enough for some cases.
 	# We probably need something like  "--list-steps names_only".
 	# In practice, almost nobody sets such names.
+	# Ignore failures like rare random "error.BrokenPipe" here.
+	# If they are real, they would appear in "ezig build test" anyway.
 	if grep -q '^[ ]*test[ ]' < <(
-		nonfatal ezig build --list-steps "${args[@]}" ||
-			die "ZBS: listing steps failed"
+		nonfatal ezig build --list-steps "${args[@]}"
 	); then
 		einfo "ZBS: testing with: ${args[@]}"
 		nonfatal ezig build test "${args[@]}" ||
-- 
2.47.0


                 reply	other threads:[~2024-12-15 21:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241215215437.4374-1-bratishkaerik@landless-city.net \
    --to=bratishkaerik@landless-city.net \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox