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 EF01B3857832 for ; Wed, 3 Mar 2021 22:58:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EF01B3857832 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 librem (deer0x15.wildebeest.org [172.31.17.151]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 601B8304319B; Wed, 3 Mar 2021 23:58:43 +0100 (CET) Received: by librem (Postfix, from userid 1000) id 971F4C065B; Wed, 3 Mar 2021 23:57:29 +0100 (CET) Date: Wed, 3 Mar 2021 23:57:29 +0100 From: Mark Wielaard To: Tom de Vries Cc: dwz@sourceware.org, jakub@redhat.com Subject: Re: [PATCH] Clean up temporary file in hardlink mode Message-ID: <20210303225729.GJ3014@wildebeest.org> References: <20210302101025.GA23663@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210302101025.GA23663@delia> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 22:58:49 -0000 Hi Tom, On Tue, Mar 02, 2021 at 11:10:27AM +0100, Tom de Vries wrote: > Consider an executable file with hardlinks a.out and b.out. > > When running dwz once: > ... > $ dwz -h a.out b.out > ... > a.out and b.out are updated, and remain hardlinks to the same file. > > But when running dwz once more, a.out and b.out remain unchanged, and a > temporary file b.out.#dwz#.XXXXXX is left. > > This is caused by the fact that the code in function dwz that is intended to > handle unchanged hardlinks is never triggered. It is guarded by a > "resa[n].res == 1" condition, but res->res is set to 0 at the end of function > dwz, irrespective of whether the file changed or not. > > Fix this by only setting res->res to 0 if the file changed. This looks correct. This works because at the start of the dwz function res->res is set to -1 (ignore) or 1 (unchanged) and then only set to -2 for the hardlink case or 0 if write_dso succeeds. > This makes test-case twice-multifile.sh fail, we'll deal with that in a > seperate patch. I haven't look at that patch yet, but if at all possible I would like to get them in together. Or otherwise make the testcase skip. Having failing tests in between commits makes things like bisecting a bit messy (and will trigger warnings from the buildbots). Thanks, Mark