From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 82ED53858C39; Sat, 14 Jan 2023 01:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82ED53858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673658436; bh=NeROXzpQgiCwdGwXc8pU9c5IZGfsauTQX9VMcuxqqpQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uULM/uA6h3VvGyNuJ7V8WJKdJB3ku4cC0A4Jrek4eE7GFnQ3yBzUQGcv/UI0Q3EmI fzoXBltwBT+BT0tsEdGueaQrlsob0KvAIrcHijxb4HMC3nfJ4Q+VebyGmxq8cM8v+Y ooZvXq8jdCEkeWkm8Rl8clOWJqZ8Nl33PuSMOD8k= From: "amerey at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/29999] Bogus error message printed when debuginfod doesn't find source file Date: Sat, 14 Jan 2023 01:07:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amerey at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29999 --- Comment #1 from Aaron Merey --- Created attachment 14592 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14592&action=3Ded= it patch (In reply to Simon Marchi from comment #0) > I think this use of errno, in print_source_lines_base, is incorrect: >=20 > https://gitlab.com/gnutools/binutils-gdb/-/blob/ > 6f9f448118eaeaf006f867a25699aef7d8c72770/gdb/source.c#L1357 >=20 > The last thing we did before this was to call into debuginfod_find_source, > which returned -2 (meaning ENOENT, which makes sense). But the errno val= ue > after calling debuginfod_find_source is not defined, and I think this > results in an error message that does not make sense. It looks like errno gets set in find_and_open_source (in the case of ENOENT= at least) before the call to debuginfod_find_source: https://gitlab.com/gnutools/binutils-gdb/-/blob/6f9f448118eaeaf006f867a2569= 9aef7d8c72770/gdb/source.c#L1179 However function calls within debuginfod_find_source may end up reassigning errno to a value unrelated to the status of the download, even if the downl= oad is successful. debuginfod_find_source returns a negative errno indicating t= he actual reason for a failed download. This is the errno that should be repor= ted to the user, not one related to routine cache creation, for example. We also don't want to hide an errno set in find_and_open_source. debuginfod errors are already reported in the debuginfod progress output, so I think we should save errno before calling debuginfod_find_source and revert errno to= the saved value afterwards. This way both debuginfod errors and find_and_open_source errors are correctly reported to the user. I've attached a patch for this. --=20 You are receiving this mail because: You are on the CC list for the bug.=