From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8FD73858D20; Fri, 22 Mar 2024 12:29:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8FD73858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1711110540; bh=drIixNvrl5Pc51XP3qJkPcYgoeGWdqKmBcSvnX3H1gw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IOp9jDcom3RAxSrbLkrGK///eWm9B5UIC3gd9qkP2ft55ynz2yr3X2KGPz/65FWqU sfnqKpgHrBihr4OS45NnlDtjFWw++jQH3lilkYlC2BIt4vMnqP69CBl+8ltTOAcl7v mIVE3kIIwwJKP3PADIQW/S652MIP0vYWnUsWTLFM= From: "mark at klomp dot org" To: debugedit@sourceware.org Subject: [Bug debugedit/31504] debugedit writes out ELF file even when nothing has been updated Date: Fri, 22 Mar 2024 12:29:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: debugedit X-Bugzilla-Component: debugedit X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status 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=3D31504 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #6 from Mark Wielaard --- (In reply to Allan McRae from comment #5) > > I can add a check to see if there actually were any changes and if ther= e aren't simply not call elf_update at all. But I suspect that is really a = corner case that doesn't occur that often. At least why would you call debu= gedit explicitly asking to rewrite things and then expect it to not actuall= y do that? >=20 > Our packaging system checks for ELF files and tries generating associated > debug packages with source files and debug symbols. It turns out there a= re > a lot of packages that provide a .NET 8.0 self-contained/ single-file > application, which is and ELF file and did not enjoy being processed by > debugedit. I understand that. And I think these aren't really "ELF" files because they= add something to the file that isn't described by the ELF structures. What I do= n't fully understand is why you are expecting debugedit to NOT change the debug path strings when you are asking it to. Is this because there file don't actually contain any .debug sections? > The v2 patch fixes the issue we observed. Thanks for double checking. Pushed: commit 6dd28bb30320e5236b3b5f79b6b2b41d2b2317bd Author: Mark Wielaard Date: Mon Mar 18 23:37:47 2024 +0100 debugedit: Only write the ELF file when updating strings or build-id Only open the ELF file read/write and write out the data if we actually did any elf structure update or updating the build-id. * tools/debugedit.c (fdopen_dso): Call elf_begin with ELF_C_READ when not changing dest_dir or build_id, otherwise use ELF_C_RDWR. (main): Call open with O_RDONLY when not changing dest_dir or build_id, otherwise use O_RDWR. Call elf_update with ELF_C_WRITE when rewriting any string, updating any ELF structure or build_id. https://sourceware.org/bugzilla/show_bug.cgi?id=3D31504 Signed-off-by: Mark Wielaard --=20 You are receiving this mail because: You are on the CC list for the bug.=