From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 0DC283851C3D for ; Thu, 4 Mar 2021 08:21:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0DC283851C3D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2C67FABE4; Thu, 4 Mar 2021 08:21:04 +0000 (UTC) Subject: Re: [PATCH] Clean up temporary file in hardlink mode To: Mark Wielaard Cc: dwz@sourceware.org, jakub@redhat.com References: <20210302101025.GA23663@delia> <20210303225729.GJ3014@wildebeest.org> From: Tom de Vries Message-ID: <3ba0c3db-21e8-17fd-cbec-31d600df8284@suse.de> Date: Thu, 4 Mar 2021 09:21:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210303225729.GJ3014@wildebeest.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: 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: Thu, 04 Mar 2021 08:21:06 -0000 On 3/3/21 11:57 PM, Mark Wielaard wrote: > 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). Committed them together. Thanks, - Tom