From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id A53A0385380C for ; Wed, 12 May 2021 21:13:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A53A0385380C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from reform (unknown [172.31.132.202]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id D1D74302BBED; Wed, 12 May 2021 23:13:08 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 239A02E80130; Wed, 12 May 2021 23:13:08 +0200 (CEST) Date: Wed, 12 May 2021 23:13:08 +0200 From: Mark Wielaard To: "Dmitry V. Levin" Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] elfcompress: fix exit status in case of an error Message-ID: References: <20210512160000.GA3462@altlinux.org> <20210512203527.GA7746@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210512203527.GA7746@altlinux.org> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 21:13:12 -0000 Hi Dmitry, On Wed, May 12, 2021 at 11:35:27PM +0300, Dmitry V. Levin wrote: > On Wed, May 12, 2021 at 10:29:33PM +0200, Mark Wielaard wrote: > > On Wed, May 12, 2021 at 04:00:00PM +0000, Dmitry V. Levin wrote: > > > Exit status of 255 in case of an error is probably not what elfcompress > > > users expect, change it to 1. > > > > > > Reported-by: Vitaly Chikunov > > > Fixes: 92acb57eb046 ("elfcompress: New utility.") > > > [...] > > > diff --git a/src/elfcompress.c b/src/elfcompress.c > > > index 05f3bc2c..dacaff32 100644 > > > --- a/src/elfcompress.c > > > +++ b/src/elfcompress.c > > > @@ -1358,5 +1358,5 @@ main (int argc, char **argv) > > > while (++remaining < argc); > > > > > > free_patterns (); > > > - return result; > > > + return !!result; > > > } > > > > The change to return 1 (or zero) is good. > > > > But could we instead initialize res to 1 > > That is, change process_file() to return 1 (or EXIT_FAILURE) > instead of -1 in case of an error? Yes. I admit I assumed this was already in process_file. But this is really just a nitpick because I always get confused when reading the !! pattern. The important part returning zero or one from main. Thanks, Mark