mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Patrick Bellasi <derkling@google.com>
Cc: linux-kernel@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH] scripts/decodecode: Return 0 on success
Date: Wed, 18 Mar 2026 10:55:15 -0700	[thread overview]
Message-ID: <20260318105515.427ebf799e9ddd1115e3f412@linux-foundation.org> (raw)
In-Reply-To: <20260318150545.2809311-1-derkling@google.com>

On Wed, 18 Mar 2026 15:05:45 +0000 Patrick Bellasi <derkling@google.com> wrote:

> The decodecode script always returns an exit code of 1, regardless of
> whether the operation was successful or not. This is because the
> "cleanup" function, which is registered to run on any script exit via
> "trap cleanup EXIT", contains an unconditional "exit 1".
> 
> Remove the "exit 1" from the "cleanup" function so that it only performs
> the necessary file cleanup without forcing a non-zero exit status.
> 
> Do that to ensure successful script executions now exit with code 0.
> Exits due to errors are all handled by the "die()" function and will
> still correctly exit with code 1.
> 
> ...
>
> --- a/scripts/decodecode
> +++ b/scripts/decodecode
> @@ -12,7 +12,6 @@ faultlinenum=1
>  
>  cleanup() {
>  	rm -f $T $T.s $T.o $T.oo $T.aa $T.dis
> -	exit 1
>  }
>  
>  die() {
> @@ -49,7 +48,7 @@ done
>  
>  if [ -z "$code" ]; then
>  	rm $T
> -	exit
> +	die "Code line not found"
>  fi
>  
>  echo $code

Seems reasonable.  Randy added this in 2008 - I'm sure he can remember
why ;)


  reply	other threads:[~2026-03-18 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 15:05 Patrick Bellasi
2026-03-18 17:55 ` Andrew Morton [this message]
2026-03-18 22:02   ` Randy Dunlap

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=20260318105515.427ebf799e9ddd1115e3f412@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=derkling@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.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

all inboxes | Powered by JetHome®