From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6G6tN00JvF/CUgAAWB0awg (envelope-from ) for ; Mon, 23 Nov 2020 14:11:09 -0500 Received: by simark.ca (Postfix, from userid 112) id DD4A81F0AB; Mon, 23 Nov 2020 14:11:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3952A1E552 for ; Mon, 23 Nov 2020 14:11:09 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCC753857C6F; Mon, 23 Nov 2020 19:11:08 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 4B1783857C6F for ; Mon, 23 Nov 2020 19:11:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B1783857C6F 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 5EE11ACC4 for ; Mon, 23 Nov 2020 19:11:06 +0000 (UTC) Subject: [committed][gdb] Don't return non-existing path in debuginfod_source_query From: Tom de Vries To: gdb-patches@sourceware.org References: <20201116111633.GA3063@delia> Message-ID: Date: Mon, 23 Nov 2020 20:11:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201116111633.GA3063@delia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 11/16/20 12:16 PM, Tom de Vries wrote: > Hi, > > When setting env var DEBUGINFOD_URLS to " " and running the testsuite, we run > into these regressions: > ... > FAIL: gdb.base/list-missing-source.exp: info source > FAIL: gdb.base/source-dir.exp: info source before setting directory search list > ... > > Setting var DEBUGINFOD_URLS to " " allows the debuginfod query function > debuginfod_source_query to get past its early exit. > > The function debuginfod_source_query is documented as: "If the file is > successfully retrieved, its path on the local machine is stored in DESTNAME". > > However, in case we get back -ENOENT from libdebuginfod, we still set > DESTNAME: > .... > if (fd.get () < 0 && fd.get () != -ENOENT) > printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), > safe_strerror (-fd.get ()), > styled_string (file_name_style.style (), srcpath)); > else > *destname = make_unique_xstrdup (srcpath); > > return fd; > ... > > Fix this by making debuginfod_source_query fit it's documentation and only > setting DESTNAME when successfully retrieving a file. Likewise in > debuginfod_debuginfo_query. > > Any comments? > Now committed. Thanks, - Tom > [gdb] Don't return non-existing path in debuginfod_source_query > > gdb/ChangeLog: > > 2020-11-16 Tom de Vries > > * debuginfod-support.c (debuginfod_source_query) > (debuginfod_debuginfo_query): Only set DESTNAME if successful. > > --- > gdb/debuginfod-support.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c > index a7c76ab6134..e21b2f40cae 100644 > --- a/gdb/debuginfod-support.c > +++ b/gdb/debuginfod-support.c > @@ -134,7 +134,8 @@ debuginfod_source_query (const unsigned char *build_id, > printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), > safe_strerror (-fd.get ()), > styled_string (file_name_style.style (), srcpath)); > - else > + > + if (fd.get () >= 0) > *destname = make_unique_xstrdup (srcpath); > > return fd; > @@ -169,7 +170,8 @@ debuginfod_debuginfo_query (const unsigned char *build_id, > safe_strerror (-fd.get ()), > styled_string (file_name_style.style (), filename)); > > - destname->reset (dname); > + if (fd.get () >= 0) > + destname->reset (dname); > > return fd; > } >