]> sourceware.org Git - libabigail.git/commitdiff
abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path'
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 10 Dec 2021 10:42:04 +0000 (11:42 +0100)
committerDodji Seketeli <dodji@redhat.com>
Mon, 20 Dec 2021 15:42:13 +0000 (16:42 +0100)
... 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 <thomas@codesourcery.com>
tools/abipkgdiff.cc

index 7fc833b20018d3dd40d26eb060690b1f708a75c5..ef9fabf236fb6a0455cf215d6ca51776cf073e18 100644 (file)
@@ -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))
This page took 0.03664 seconds and 5 git commands to generate.