Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig.eclass: fix rare spurious error.BrokenPipe during src_test #39723

Closed

Conversation

BratishkaErik
Copy link
Contributor

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):

$ 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.


Please check all the boxes that apply:

  • I can submit this contribution in agreement with the Copyright Policy.
  • I have certified the above via adding a Signed-off-by line to every commit in the pull request.
  • This contribution has not been created with the assistance of Natural Language Processing artificial intelligence tools, in accordance with the AI policy.
  • I have run pkgcheck scan --commits --net to check for issues with my commits.

Please note that all boxes must be checked for the pull request to be merged.

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@landless-city.net>
@gentoo-bot
Copy link

Pull Request assignment

Submitter: @BratishkaErik
Areas affected: eclasses
Packages affected: (none)

@gentoo/github

Linked bugs

No bugs to link found. If your pull request references any of the Gentoo bug reports, please add appropriate GLEP 66 tags to the commit message and request reassignment.

New packages

This Pull Request appears to be introducing new packages only. Due to limited manpower, adding new packages is considered low priority. This does not mean that your Pull Request will not receive any attention, however, it might take quite some time for it to be reviewed. In the meantime, your new ebuild might find a home in the GURU project repository: the ebuild repository maintained collaboratively by Gentoo users. GURU offers your ebuild a place to be reviewed and improved by other Gentoo users, while making it easy for Gentoo users to install it and enjoy the software it adds.


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added the need assignment It was impossible to assign the PR correctly. Please assign it manually. label Dec 15, 2024
@BratishkaErik
Copy link
Contributor Author

BratishkaErik commented Dec 15, 2024

Sometimes it also hides real errors:

>>> Test phase: dev-lang/zig-0.13.0-r2
 * ZBS: testing with: -j7 -Dtarget=native -Dcpu=x86_64_v3 --release=safe --prefix-exe-dir bin/ --prefix-lib-dir lib64/ --prefix-include-dir include/ --prefix usr/ --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --summary all --verbose --build-file /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/build.zig --zig-lib-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/ --prefix-lib-dir lib/ -Dno-langref -Dstd-docs=false --release=fast -Denable-llvm=true -Dstatic-llvm=false -Dconfig_h=/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/config.h -Dskip-non-native
error: BrokenPipe
/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/compiler/build_runner.zig:1073:9: 0x11c6a06 in steps__anon_9081 (build)
        try out_stream.print("  {s:<28} {s}\n", .{ name, top_level_step.description });
        ^
/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/compiler/build_runner.zig:336:9: 0x11c007c in main (build)
        return steps(builder, stdout_writer);
        ^
error: the following build command failed with exit code 1:
/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/local/o/0d2b10813df93d3d14ee85b3dcd9379b/build /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/stage3/bin/zig /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0 /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/local/ /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/global/ --seed 0x54be53e9 -Z2f2bf09d71c992dd --list-steps -j7 -Dtarget=native -Dcpu=x86_64_v3 --release=safe --prefix-exe-dir bin/ --prefix-lib-dir lib64/ --prefix-include-dir include/ --prefix usr/ --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --summary all --verbose --zig-lib-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/ --prefix-lib-dir lib/ -Dno-langref -Dstd-docs=false --release=fast -Denable-llvm=true -Dstatic-llvm=false -Dconfig_h=/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/config.h -Dskip-non-native
 * Failed to run command: ./stage3/bin/zig build --list-steps -j7 -Dtarget=native -Dcpu=x86_64_v3 --release=safe --prefix-exe-dir bin/ --prefix-lib-dir lib64/ --prefix-include-dir include/ --prefix usr/ --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --summary all --verbose --build-file /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/build.zig --zig-lib-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/ --prefix-lib-dir lib/ -Dno-langref -Dstd-docs=false --release=fast -Denable-llvm=true -Dstatic-llvm=false -Dconfig_h=/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/config.h -Dskip-non-native
 * ERROR: dev-lang/zig-0.13.0-r2::gentoo failed (test phase):
 *   ZBS: listing steps failed
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_test
 *   environment, line 3348:  Called zig_src_test '-Dskip-non-native'
 *   environment, line 5111:  Called die
 * The specific snippet of code:
 *       if grep -q '^[ ]*test[ ]' < <(nonfatal ezig build --list-steps "${args[@]}" || die "ZBS: listing steps failed"); then
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/zig-0.13.0-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/zig-0.13.0-r2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build'
 * S: '/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0'

...

test
└─ test-link
   └─ link_test_cases
      └─ test-macho
         └─ test-hello-zig-x86_64-macos.11.7.1...14.1-none-Debug-no-llvm-no-lld
            └─ run main
               └─ zig build-exe main Debug x86_64-macos 1 errors
error: unable to find libSystem system library
    note: tried /usr/lib/libSystem.tbd
    note: tried /usr/lib/libSystem.dylib
    note: tried /usr/lib/libSystem
    note: tried /usr/lib/llvm/18/lib/libSystem.tbd
    note: tried /usr/lib/llvm/18/lib/libSystem.dylib
    note: tried /usr/lib/llvm/18/lib/libSystem
error: the following command failed with 1 compilation errors:
/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/stage3/bin/zig build-exe -fno-llvm -fno-lld -ODebug -target x86_64-macos -mcpu baseline -Mroot=/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/local/o/d7ba7107f3e0a304e83356689aff43eb/a.zig --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --cache-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/local/ --global-cache-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/global/ --name main -L /usr/lib/llvm/18/lib -I /usr/lib/llvm/18/include --listen=- 
/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/stage3/bin/zig test -ODebug -target x86_64-linux-musl -mcpu baseline -Mroot=/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/std/std.zig -lc --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --cache-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/local/ --global-cache-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig-cache/global/ --name test -L /usr/lib/llvm/18/lib -I /usr/lib/llvm/18/include --zig-lib-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib --listen=- 

>>> Failed to emerge dev-lang/zig-0.13.0-r2, Log file:

>>>  '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/build.log'

 * Messages for package dev-lang/zig-0.13.0-r2:

 * Failed to run command: ./stage3/bin/zig build --list-steps -j7 -Dtarget=native -Dcpu=x86_64_v3 --release=safe --prefix-exe-dir bin/ --prefix-lib-dir lib64/ --prefix-include-dir include/ --prefix usr/ --libc /var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/zig_libc.txt --summary all --verbose --build-file /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/build.zig --zig-lib-dir /var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0/lib/ --prefix-lib-dir lib/ -Dno-langref -Dstd-docs=false --release=fast -Denable-llvm=true -Dstatic-llvm=false -Dconfig_h=/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build/config.h -Dskip-non-native
 * ERROR: dev-lang/zig-0.13.0-r2::gentoo failed (test phase):
 *   ZBS: listing steps failed
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_test
 *   environment, line 3348:  Called zig_src_test '-Dskip-non-native'
 *   environment, line 5111:  Called die
 * The specific snippet of code:
 *       if grep -q '^[ ]*test[ ]' < <(nonfatal ezig build --list-steps "${args[@]}" || die "ZBS: listing steps failed"); then
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/zig-0.13.0-r2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/zig-0.13.0-r2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0_build'
 * S: '/var/tmp/portage/dev-lang/zig-0.13.0-r2/work/zig-0.13.0'
 * 
 * The following package has failed to build, install, or execute postinst:
 * 
 *  (dev-lang/zig-0.13.0-r2:0.13/0.13::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/tmp/portage/dev-lang/zig-0.13.0-r2/temp/build.log'
 * 

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2024-12-15 21:55 UTC
Newest commit scanned: 113e676
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/af49e14/output.html

@BratishkaErik
Copy link
Contributor Author

Thanks!

@BratishkaErik BratishkaErik deleted the zig-eclass-brokenpipe branch December 22, 2024 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need assignment It was impossible to assign the PR correctly. Please assign it manually.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants