From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=RxXBhaz/; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id BD6B65A004F for ; Mon, 23 Sep 2024 05:54:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1727063686; bh=reR1Q7RxRhNt9YjceUZrP81bL0IvkMEdIt9rhawhXoo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RxXBhaz/DDCY6CbjK1l2TncUkTyaWm73U75KnsajgOD7cqPSFkAeD8xNZWebuUNPO Z5SQ+Im4ZKLQw0rx9rycDRwrE/fk/M+M/7gGNSmTBNRVHfFu75N6mVTiLRx1LcPmE2 AljcCSmQvFRvlk+T1ly3DTtvD0c2UsMMOq4i06c7pQkXoJcPS5NsuL+Qz0oXd3Yddp 0aQoXO7/WEYUoshuiIaaOWoNSxqin7UT1JyptfEHHwl9MVrVDWCtZDya6MkFfwqgTE mjnMI0iaPSBCZedBtAE2KfpBeLUWQxVbydl6xA/Y4cCeCbuwi3bhVQssDeLiIaaTTK R8oNBo1uOq/sA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XBpzB47r4z4wyk; Mon, 23 Sep 2024 13:54:46 +1000 (AEST) Date: Mon, 23 Sep 2024 13:51:42 +1000 From: David Gibson To: Lukasz Gut Subject: Re: [PATCH v2 1/4] mbuto: Pick a src when ld reported as link by ldd Message-ID: References: <20240918101532.85299-1-lgut@lgut.eu> <20240918101532.85299-3-lgut@lgut.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tqwdMBss/dF5olTo" Content-Disposition: inline In-Reply-To: <20240918101532.85299-3-lgut@lgut.eu> Message-ID-Hash: F4K2K3HN3I2SCDZWVZZY5ZBUGNNHJURC X-Message-ID-Hash: F4K2K3HN3I2SCDZWVZZY5ZBUGNNHJURC X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: sbrivio@redhat.com, sevinj.aghayeva@gmail.com, passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --tqwdMBss/dF5olTo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D> /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. > Signed-off-by: Lukasz Gut > --- > mbuto | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) >=20 > 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=3D"${__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 =3D> /usr/lib64/ld-linux-x86-64.so.2 > + # Make sure to take only right part in this case. > + __ld_path=3D"${__ld_so##*=3D> }" > + > + if [ -n "${__ld_path}" ]; then > + libs_copy_ld_so "${__ld_path}" > + libs_path_add "${__ld_path##${wd}}" > fi > } > =20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --tqwdMBss/dF5olTo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbw5c0ACgkQzQJF27ox 2GfDuQ/+P+nwjky0PMFhzhnr+L4TSoGKfKHcf0bt3IgkbsE/6Vd6Bs1go+LuaPdN EnzUiTmxVrxAjRKfarQL6dF9Kfh6oiwuGTCCYYu83Kqv0RbcaeKiTmFmOoRz4eQ9 GkPjEpBkKUSDNo/Xy73MN8Q6bOfwGi/2RlQoof4Kf2Ms8Ib83pPjDnQPNmY0z2mg ybphKv7nVMxFwmsBIaq2a//00WUdW9T6MdlTWWBQQoLtEb7Iup4gp4Iu3a3wVMH7 KLd7fsD3sidyJDo7t6jeA0uBmtPn5EfZiPeMA0VIUhk6WNa+JO5YTWReOc1P7f1G jjyHym4kdxafaXtnpV3MOjqSIzns+wkleDKyJNQM+Db1bKqO7a2ZThCuzQw/2v/Y +wFOxKrUt0Qp0FAijz121h6iADUYx1nUCA9fiv70U0vuC0ObG5vnnVugZ96wV3zu nAG+8Ogs3IQol77z6YElHLBpEWShHTjKu/07GKNlnP7LtmJPk+9bACjPTn08K+5U 5RyLo5edL2gBJPvW7Zhxa3JzwyWbHyLRMiGzHLaiEQYe3Hjhj411weehTtszwI8m Vdg4ajs45KxxGfkrQFz/eCkmd/FfrGgfEoVawSS3tzFp+8tb/XEC0RRsl2U9mhN7 57WZlwCAfEngOvixlOGC+wCIOyfym+9woEhi8/bQqYTjjhoGhIA= =mPEB -----END PGP SIGNATURE----- --tqwdMBss/dF5olTo--