From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 9972B3858D35 for ; Fri, 17 Dec 2021 09:27:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9972B3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 1Awvqyr1SXZd0Ijm8yjuQoFTF8StFttj6xkT9b84SwFoByeMA17p2qfODB9lmemujGBZMDS8fE WMUQ5MTW+EQr3+NuNMw2Pe0Nv/K86uyMZAza2vppWRqN/yGspPcR/NGyFmq9/04EfoBH70GMZf VvkGGasafcrJOuKIoFoTGmowlLA/WsBYPoPLLMhY70RdhgwkmfNzuPOwkmKZrDRF5VI7iq1ATO Q2TG5DFSnYAETy4yu4c1EC/J8rRoE3EuVoGV/jmOokyq6AtQM799WiFWm1V3C3XaUGK6phAY4T IwLAcOXmX4LixZpDZmwb7gNo X-IronPort-AV: E=Sophos;i="5.88,213,1635235200"; d="scan'208";a="69669383" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 17 Dec 2021 01:27:49 -0800 IronPort-SDR: uFgEp4s+W4QRx71Nmm+gHZKjm97NkHwjCobbdh+NOiU2t2xkFzWQyGBXJ4ZZlL3l+ZrpNjxUmP yWlftOFkHl53nI9h5gkg74ulOc73mr41XgsLEvMxV9nflTZjbve36tNd3f+URxUKLeWTrR32Wz DvgEXLvejL6G7F2oW2fuSKTWbxN4t+JfYkXPX9cG1sEyqN6ci9gfy3OyMjkFbCioa9DH/ig8v4 fRFYoSCwq5q2dWekN9tSQD5qWOlbxofLaZSbFiwTqc4syUgo/i/sRrLGDiBvK/2IYft34z8Yn6 d2w= From: Thomas Schwinge To: Subject: Re: [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path' In-Reply-To: <20211210104204.3248704-1-thomas@codesourcery.com> References: <20211210104204.3248704-1-thomas@codesourcery.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 17 Dec 2021 10:27:39 +0100 Message-ID: <87lf0jy41g.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2021 09:27:50 -0000 Hi! Ping. Gr=C3=BC=C3=9Fe Thomas On 2021-12-10T11:42:04+0100, I wrote: > ... instead of open-coding it, insufficiently. > > On one system, I have a '/home' -> 'media/[...]/home' symlink, so: > > $ readlink -f /home/thomas/.cache > /media/[...]/home/thomas/.cache > > Now: > > Thread 4 "abipkgdiff" hit Breakpoint 1, package::create_abi_file_path= (this=3D0x5555555a7990, > elf_file_path=3D"/media/[...]/home/thomas/.cache/libabigail/abipk= gdiff-tmp-dir-upGgLK/package1/usr/lib64/libGLU.so.1.3.1", abi_file_path=3D"= ") at [...]/tools/abipkgdiff.cc:668 > 668 create_abi_file_path(const string &elf_file_path, > (gdb) n > 671 string abi_path, dir, parent; > (gdb) n > 672 if (!abigail::tools_utils::string_suffix(elf_file_path, > (gdb) n > 675 return false; > > So we unexpectedly 'return false' here. That's because of 'elf_file_path= ' as > above ('realpath'ed) vs. 'extracted_dir_path()' as follows (not 'realpath= 'ed): > > (gdb) print extracted_dir_path() > $1 =3D "/home/thomas/.cache/libabigail/abipkgdiff-tmp-dir-upGgLK/pack= age1" > > Avoid that by just using 'convert_path_to_relative' here. > > (I did not generally review the code for other such problems...) > > * tools/abipkgdiff.cc (create_abi_file_path): Use > 'convert_path_to_relative'. > > Signed-off-by: Thomas Schwinge > --- > tools/abipkgdiff.cc | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git tools/abipkgdiff.cc tools/abipkgdiff.cc > index 7fc833b2..ef9fabf2 100644 > --- tools/abipkgdiff.cc > +++ tools/abipkgdiff.cc > @@ -667,9 +667,7 @@ public: > string &abi_file_path) const > { > string abi_path, dir, parent; > - if (!abigail::tools_utils::string_suffix(elf_file_path, > - extracted_dir_path(), > - abi_path)) > + if (!convert_path_to_relative(elf_file_path, abi_path)) > return false; > abi_path =3D extracted_dir_path() + "/abixml" + abi_path + ".abi"; > if (!abigail::tools_utils::ensure_parent_dir_created(abi_path)) > -- > 2.25.1 ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955