From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1702323-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id DE3041580FD
	for <garchives@archives.gentoo.org>; Sun, 22 Dec 2024 01:31:03 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D5E18E08BB;
	Sun, 22 Dec 2024 01:31:02 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 6743CE08BB
	for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 01:31:01 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 33D0F33BE19
	for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 01:31:00 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 8CD251C57
	for <gentoo-commits@lists.gentoo.org>; Sun, 22 Dec 2024 01:30:58 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1734830867.38e96b4caa2c618b9410e787c4b29cde207dab94.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/zig.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 38e96b4caa2c618b9410e787c4b29cde207dab94
X-VCS-Branch: master
Date: Sun, 22 Dec 2024 01:30:58 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: a97176a8-d70a-475b-a0a6-9e18cd5d1229
X-Archives-Hash: b5f3a0641a334fffc28db381afae99f0

commit:     38e96b4caa2c618b9410e787c4b29cde207dab94
Author:     Eric Joldasov <bratishkaerik <AT> landless-city <DOT> net>
AuthorDate: Sun Dec 15 21:18:29 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 22 01:27:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38e96b4c

zig.eclass: fix rare spurious `error.BrokenPipe` during `src_test`

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.

Signed-off-by: Eric Joldasov <bratishkaerik <AT> landless-city.net>
Closes: https://github.com/gentoo/gentoo/pull/39723
Signed-off-by: Sam James <sam <AT> gentoo.org>

 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[@]}" ||