public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Lukasz Gut <lgut@lgut.eu>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: sbrivio@redhat.com, sevinj.aghayeva@gmail.com, passt-dev@passt.top
Subject: Re: [PATCH v2 1/4] mbuto: Pick a src when ld reported as link by ldd
Date: Mon, 23 Sep 2024 12:09:09 +0200	[thread overview]
Message-ID: <c7862ec84028cf4924ad18a8cf5bcea447527b6c.camel@lgut.eu> (raw)
In-Reply-To: <ZvDlzqAL8uGHck-3@zatzit.fritz.box>

On Mon, 2024-09-23 at 13:51 +1000, David Gibson wrote:
> On Wed, Sep 18, 2024 at 12:12:56PM +0200, Lukasz Gut wrote:
> > On Arch Linux ldd /bin/sh reports:
> >     /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2
> > Use a regex to pick only right side and use it for path processing.
> 
> I think this approach is overly specific.  The broader point here is
> that ldd can list libraries (including the dynamic linker) as either a
> link, or directly as a file.  In the cases Stefano wrote for, it was
> always a single file for the dynamic linker and a link for everything
> else.  For Arch it seems to be a link for everything, but both of
> those might not be true everywhere.
> 
> It would make more sense to alter the loop above which processes all
> libraries to handle both the link and no-link cases, and remove the
> special case handling of ld.so.

That's a very good point. I have even briefly tried that before, since
that should produce less code instead of more, but I've had some
difficulties. I will attempt it again.
> 
> > Signed-off-by: Lukasz Gut <lgut@lgut.eu>
> > ---
> >  mbuto | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/mbuto b/mbuto
> > index b80ea78..1c3b347 100755
> > --- a/mbuto
> > +++ b/mbuto
> > @@ -704,9 +704,14 @@ __libs_copy() {
> >  	for __l in $("${LDD}" "${1}" 2>/dev/null); do
> >  		case ${__l} in "/"*" "*) __ld_so="${__l% *}" ;; *) ;; esac
> >  	done
> > -	if [ -n "${__ld_so}" ]; then
> > -		libs_copy_ld_so "${__ld_so}"
> > -		libs_path_add "${__ld_so##${wd}}"
> > +	# On Arch Linux ld is reported by ldd in form:
> > +	# /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2
> > +	# Make sure to take only right part in this case.
> > +	__ld_path="${__ld_so##*=> }"
> > +
> > +	if [ -n "${__ld_path}" ]; then
> > +		libs_copy_ld_so "${__ld_path}"
> > +		libs_path_add "${__ld_path##${wd}}"
> >  	fi
> >  }
> >  
> 
--
Lukasz

  reply	other threads:[~2024-09-23 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 10:12 [PATCH v2 0/4] mbuto: Make it work on Arch Linux Lukasz Gut
2024-09-18 10:12 ` [PATCH v2 1/4] mbuto: Pick a src when ld reported as link by ldd Lukasz Gut
2024-09-23  3:51   ` David Gibson
2024-09-23 10:09     ` Lukasz Gut [this message]
2024-09-18 10:12 ` [PATCH v2 2/4] mbuto: Use realpath to copy ld Lukasz Gut
2024-09-23  3:53   ` David Gibson
2024-09-23 10:09     ` Lukasz Gut
2024-09-18 10:12 ` [PATCH v2 3/4] mbuto: Don't try to add ld when adding libraries Lukasz Gut
2024-09-18 10:12 ` [PATCH v2 4/4] mbuto: Automatically add links related to linker Lukasz Gut
2024-09-23  3:54   ` David Gibson
2024-09-23 10:09     ` Lukasz Gut
2024-09-23  3:45 ` [PATCH v2 0/4] mbuto: Make it work on Arch Linux David Gibson
2024-09-23 10:09   ` Lukasz Gut

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=c7862ec84028cf4924ad18a8cf5bcea447527b6c.camel@lgut.eu \
    --to=lgut@lgut.eu \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    --cc=sevinj.aghayeva@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).