From: Keith Seitz <keiths@redhat.com>
To: Mark Wielaard <mark@klomp.org>
Cc: debugedit@sourceware.org
Subject: Re: [PATCH] find-debuginfo.sh: Exit with real exit status in parallel jobs
Date: Mon, 19 Aug 2024 12:51:12 -0700 [thread overview]
Message-ID: <ea181c27-0ac0-4873-a5d8-a3cc18a9b6c4@redhat.com> (raw)
In-Reply-To: <20240817212015.GA17272@gnu.wildebeest.org>
On 8/17/24 2:20 PM, Mark Wielaard wrote:
> On Fri, Aug 16, 2024 at 11:54:20AM -0700, Keith Seitz wrote:
>> Currently, when the script is executed in parallel (-jN), the
>> resulting exit status will always be 0.
>>
>> The script execs an appropriate number of clones of itself, calling
>> run_job to run the actual workload. This then calls do_file(), saving
>> the exit status into "res.$jobid".
>>
>> In do_file(), though, if an error occurs, exit is called. This causes
>> the entire exec'd shell to exit with status 0 (since there are almost
>> always echo calls as the last executed statement). The real exit
>> status is therefor never written to the "res.$jobid" files by run_job().
>>
>> The simple solution is to use 'return' instead of 'exit'. A number
>> of minor adjustments are also made to propagate this properly so that
>> it is reported as the correct exit status.
>
> Good find. Code looks correct. Except don't we now also need to check
> the result of do_file () in the non-parallel case? Something like:
>
> diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in
> index f40e566f86c3..5998b9d1fa6c 100755
> --- a/scripts/find-debuginfo.in
> +++ b/scripts/find-debuginfo.in
> @@ -579,6 +579,10 @@ fi
> if [ $n_jobs -le 1 ]; then
> while read nlinks inum f; do
> do_file "$nlinks" "$inum" "$f"
> + res=$?
> + if [ "$res" != "0" ]; then
> + exit $res
> + fi
> done <"$temp/primary"
> else
> for ((i = 1; i <= n_files; i++)); do
Yes, that does look appropriate. My apologies for not following through
with the non-parallel invocation. I guess I could have (further)
modified my custom rpm package to specifically test this case, too,
and submit a more complete patch.
>> While at it, I've incorporated a patch for find-debuginfo/30505.
>> Using this patch and another patch to the RPM package (submitted as
>> github issue #3215), failures of gdb-add-index.sh will now properly fail
>> the build instead of being swallowed. It should be much easier for
>> developers to figure out why their builds have failed should gdb crash.
>
> Thanks, that has been a long standing issue. Smart to introduce a new
> _find_debuginfo_exit_on_error for rpm-config. The reason errors
> weren't reported in the past was because people would then disable
> creating debuginfo packages completely. But these days we really
> should report (and fix) any errors.
>
> There are a couple of other places, the main debugedit invocation,
> strip_to_debug, add_minidebug, which really should report errors
> too. But that can wait.
Indeed. I'm selfish, so I am attempting to improve testing for
areas for which I am directly responsible, but perhaps I can add
that to a TODO and give it a try with my mass prebuilder some time
to verify.
In any case, a step in the right direction. Thank you for the review!
Keith
next prev parent reply other threads:[~2024-08-19 19:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 18:54 Keith Seitz
2024-08-17 21:20 ` Mark Wielaard
2024-08-19 19:51 ` Keith Seitz [this message]
2024-08-20 14:51 ` Mark Wielaard
2024-08-20 20:26 ` Keith Seitz
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=ea181c27-0ac0-4873-a5d8-a3cc18a9b6c4@redhat.com \
--to=keiths@redhat.com \
--cc=debugedit@sourceware.org \
--cc=mark@klomp.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).