From patchwork Fri Dec 10 10:42:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 48768 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 601A53857C67 for ; Fri, 10 Dec 2021 10:43:25 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.31.99]) by sourceware.org (Postfix) with ESMTPS id BD0583858020 for ; Fri, 10 Dec 2021 10:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD0583858020 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=schwinge.name Received: from [192.94.31.2] (helo=dem-tschwing-1.ger.mentorg.com) by smtprelay05.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mvdLk-00060M-7K; Fri, 10 Dec 2021 11:42:00 +0100 Received: (nullmailer pid 3248768 invoked by uid 1000); Fri, 10 Dec 2021 10:42:10 -0000 From: Thomas Schwinge To: libabigail@sourceware.org Subject: [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path' Date: Fri, 10 Dec 2021 11:42:04 +0100 Message-Id: <20211210104204.3248704-1-thomas@codesourcery.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Df-Sender: b3V0Z29pbmdAc2Nod2luZ2UubmFtZQ== X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: , Cc: Thomas Schwinge Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" ... 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=0x5555555a7990, elf_file_path="/media/[...]/home/thomas/.cache/libabigail/abipkgdiff-tmp-dir-upGgLK/package1/usr/lib64/libGLU.so.1.3.1", abi_file_path="") 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 = "/home/thomas/.cache/libabigail/abipkgdiff-tmp-dir-upGgLK/package1" 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 = extracted_dir_path() + "/abixml" + abi_path + ".abi"; if (!abigail::tools_utils::ensure_parent_dir_created(abi_path))