* [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path'
@ 2021-12-10 10:42 Thomas Schwinge
2021-12-17 9:27 ` Thomas Schwinge
2021-12-20 15:57 ` Dodji Seketeli
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Schwinge @ 2021-12-10 10:42 UTC (permalink / raw)
To: libabigail; +Cc: Thomas Schwinge
... 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 | 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))
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path'
2021-12-10 10:42 [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path' Thomas Schwinge
@ 2021-12-17 9:27 ` Thomas Schwinge
2021-12-20 15:57 ` Dodji Seketeli
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Schwinge @ 2021-12-17 9:27 UTC (permalink / raw)
To: libabigail
Hi!
Ping.
Grüße
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=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 | 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))
> --
> 2.25.1
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path'
2021-12-10 10:42 [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path' Thomas Schwinge
2021-12-17 9:27 ` Thomas Schwinge
@ 2021-12-20 15:57 ` Dodji Seketeli
1 sibling, 0 replies; 3+ messages in thread
From: Dodji Seketeli @ 2021-12-20 15:57 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: libabigail
Thomas Schwinge <thomas@codesourcery.com> a écrit:
[...]
>
> * tools/abipkgdiff.cc (create_abi_file_path): Use
> 'convert_path_to_relative'.
>
> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Applied to master, thanks!
[...]
Cheers,
--
Dodji
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-20 15:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 10:42 [PATCH] abipkgdiff: Use 'convert_path_to_relative' in 'create_abi_file_path' Thomas Schwinge
2021-12-17 9:27 ` Thomas Schwinge
2021-12-20 15:57 ` Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).