public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do"
@ 2021-05-12 15:00 Dmitry V. Levin
  2021-05-12 19:18 ` Dmitry V. Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2021-05-12 15:00 UTC (permalink / raw)
  To: elfutils-devel

When elfcompress decides that no section data needs to be updated and
therefore the file does not have to be rewritten, it still has to exit
with a zero status indicating success.

Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856
Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
---
 src/ChangeLog     | 4 ++++
 src/elfcompress.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index c5ecc05b..47c7eb79 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* elfcompress.c (process_file): Set res to 0 in case of "Nothing to do".
+
 2021-04-19  Martin Liska  <mliska@suse.cz>
 
 	* elfclassify.c (run_classify): Use startswith.
diff --git a/src/elfcompress.c b/src/elfcompress.c
index d5bc3300..7340e878 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -522,6 +522,7 @@ process_file (const char *fname)
       if (verbose > 0)
 	printf ("Nothing to do.\n");
       fnew = NULL;
+      res = 0;
       goto cleanup;
     }
 
-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do"
  2021-05-12 15:00 [PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do" Dmitry V. Levin
@ 2021-05-12 19:18 ` Dmitry V. Levin
  2021-05-12 20:04   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2021-05-12 19:18 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard, Timm Bäder

On Wed, May 12, 2021 at 03:00:00PM +0000, Dmitry V. Levin wrote:
> When elfcompress decides that no section data needs to be updated and
> therefore the file does not have to be rewritten, it still has to exit
> with a zero status indicating success.
> 
> Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856
> Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")

Correction: the faulty commit is elfutils-0.184~22, I'll update the
"Fixes" tag in the commit message accordingly:

Fixes: c497478390de ("elfcompress: Replace cleanup() with label")

> ---
>  src/ChangeLog     | 4 ++++
>  src/elfcompress.c | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/src/ChangeLog b/src/ChangeLog
> index c5ecc05b..47c7eb79 100644
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,7 @@
> +2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
> +
> +	* elfcompress.c (process_file): Set res to 0 in case of "Nothing to do".
> +
>  2021-04-19  Martin Liska  <mliska@suse.cz>
>  
>  	* elfclassify.c (run_classify): Use startswith.
> diff --git a/src/elfcompress.c b/src/elfcompress.c
> index d5bc3300..7340e878 100644
> --- a/src/elfcompress.c
> +++ b/src/elfcompress.c
> @@ -522,6 +522,7 @@ process_file (const char *fname)
>        if (verbose > 0)
>  	printf ("Nothing to do.\n");
>        fnew = NULL;
> +      res = 0;
>        goto cleanup;
>      }
>  
> -- 
> ldv

-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do"
  2021-05-12 19:18 ` Dmitry V. Levin
@ 2021-05-12 20:04   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2021-05-12 20:04 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: elfutils-devel, Timm Bäder

Hi Dmitry,

On Wed, May 12, 2021 at 10:18:36PM +0300, Dmitry V. Levin wrote:
> On Wed, May 12, 2021 at 03:00:00PM +0000, Dmitry V. Levin wrote:
> > When elfcompress decides that no section data needs to be updated and
> > therefore the file does not have to be rewritten, it still has to exit
> > with a zero status indicating success.
> > 
> > Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856
> > Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
> 
> Correction: the faulty commit is elfutils-0.184~22, I'll update the
> "Fixes" tag in the commit message accordingly:
> 
> Fixes: c497478390de ("elfcompress: Replace cleanup() with label")

Thanks for tracking this regression down. Sorry I missed that in the
reviews. It is obvious in hindsight. The fix is correct.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-12 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 15:00 [PATCH 1/2] elfcompress: fix exit status in case of "Nothing to do" Dmitry V. Levin
2021-05-12 19:18 ` Dmitry V. Levin
2021-05-12 20:04   ` Mark Wielaard

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