From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
To: Dodji Seketeli <dodji@seketeli.org>
Cc: "Guillermo E. Martinez via Libabigail" <libabigail@sourceware.org>
Subject: Re: [PATCH] tools-utils: Looks for vmlinux binary in RPM debug package
Date: Thu, 9 Mar 2023 17:31:19 -0600 [thread overview]
Message-ID: <20230309233119.tfweqmfmohgoytea@kamehouse> (raw)
In-Reply-To: <875ybbpb0v.fsf@seketeli.org>
On Wed, Mar 08, 2023 at 03:34:24PM +0100, Dodji Seketeli wrote:
> Hello,
>
Hello,
> "Guillermo E. Martinez via Libabigail" <libabigail@sourceware.org> a
> écrit:
>
> I looked at the two patches you sent and I am proposing a third one
> which is kind of a merge of the two ;-)
>
> > In `abipkgdiff' working with a `kernel' package, the function
> > `get_vmlinux_path_from_kernel_dist' that looks for `vmlinux' file
> > in never reached, due to check an useless predicate.
> >
> > * tools/abipkgdiff.cc
> > (compare_prepared_linux_kernel_packages): Remove useless predicate.
>
> [...]
>
> > diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
> > index c2fc09ca..46b920a1 100644
> > --- a/tools/abipkgdiff.cc
> > +++ b/tools/abipkgdiff.cc
> > @@ -3106,8 +3106,7 @@ compare_prepared_linux_kernel_packages(package& first_package,
> >
> > string vmlinux_path1, vmlinux_path2;
> >
> > - if (!vmlinux_path1.empty()
> > - && !get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
> > + if (!get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
>
> Right, thanks for fixing the thinko there!
>
Actually you point me about it. :-).
> > {
> > emit_prefix("abipkgdiff", cerr)
> > << "Could not find vmlinux in debuginfo package '"
> > @@ -3116,8 +3115,7 @@ compare_prepared_linux_kernel_packages(package& first_package,
> > return abigail::tools_utils::ABIDIFF_ERROR;
> > }
> >
> > - if (!vmlinux_path2.empty()
> > - && !get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
> > + if (!get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
> > {
>
> Likewise.
>
> > emit_prefix("abipkgdiff", cerr)
> > << "Could not find vmlinux in debuginfo package '"
>
> [...]
>
> > When Libabigail tools work with a `kernel' package, it looks for
> > `vmlinux' file in release RPM uncompress directory, if it is not
> > found, then try find it in `debug_info_root' directory.
> >
> > * src/abg-tools-utils.cc
> > (get_binary_paths_from_kernel_dist): Add `debug_info_root' if
> > `vmlinux' file is not found in `dist_root' directory.
>
> [...]
>
> > diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
> > index 94dd8d05..8493ae90 100644
> > --- a/src/abg-tools-utils.cc
> > +++ b/src/abg-tools-utils.cc
> > @@ -2572,20 +2572,16 @@ get_binary_paths_from_kernel_dist(const string& dist_root,
> > string kernel_modules_root;
> > string debug_info_root;
> > if (dir_exists(dist_root + "/lib/modules"))
> > - {
> > - dist_root + "/lib/modules";
> > debug_info_root = debug_info_root_path.empty()
> > - ? dist_root
> > + ? dist_root + "/usr/lib/debug"
> > : debug_info_root_path;
> > - debug_info_root += "/usr/lib/debug";
> > - }
>
> Here is how I am changing this finally:
>
> if (dir_exists(dist_root + "/lib/modules"))
> {
> kernel_modules_root = dist_root + "/lib/modules";
> debug_info_root = debug_info_root_path.empty()
> ? dist_root + "/usr/lib/debug"
> : debug_info_root_path;
> }
>
> This is because kernel_modules_root is thus going to be used below ...
>
> [...]
>
>
> > bool found = false;
> > - string from = dist_root;
> > - if (find_vmlinux_and_module_paths(from, vmlinux_path, module_paths))
> > + if (find_vmlinux_and_module_paths(dist_root, vmlinux_path, module_paths) ||
> > + find_vmlinux_and_module_paths(debug_info_root, vmlinux_path, module_paths))
> > found = true;
>
> ... Like this:
>
> // If vmlinux_path is empty, we want to look for it under
> // debug_info_root, because this is where Enterprise Linux packages
> // put it. Modules however are to be looked for under
> // kernel_modules_root.
> if (// So, Let's look for modules under kernel_modules_root ...
> find_vmlinux_and_module_paths(kernel_modules_root,
> vmlinux_path,
> module_paths)
> // ... and if vmlinux_path is empty, look for vmlinux under the
> // debug info root.
> || find_vmlinux_and_module_paths(debug_info_root,
> vmlinux_path,
> module_paths))
> found = true;
>
> [...]
>
> So, below is the resulting patch.
>
> Could you please test it in your environment and tell me if it works for
> you, the way you expect it?
>
Working as intended.
> Thanks.
>
>[...]
Thanks,
guillermo
next prev parent reply other threads:[~2023-03-09 23:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 15:50 Guillermo E. Martinez
2023-03-07 18:57 ` [PATCH v2] abipkgdiff: Remove useless code to process kernel RPM packages Guillermo E. Martinez
2023-03-08 14:34 ` [PATCH] tools-utils: Looks for vmlinux binary in RPM debug package Dodji Seketeli
2023-03-09 23:31 ` Guillermo E. Martinez [this message]
2023-03-10 7:49 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230309233119.tfweqmfmohgoytea@kamehouse \
--to=guillermo.e.martinez@oracle.com \
--cc=dodji@seketeli.org \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).