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=M6IfwAQ7; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 981165A004C for ; Tue, 27 Aug 2024 03:13:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1724721173; bh=lSN7wXGcgqOoznftlFgMUr7EmUjEsWenRsRax0L0yEQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M6IfwAQ7h0pfI0xR7848yXJm6F1eMx4Wwg+7ifxXuGXBZYXZ8ITdfzd6esJj1IuGK eJYDQ3L/PlgXTTo48twUJMhN9xTvdx1st0krB6bVSxJ3KgYqRMPxZNg0oUnBdmfdS+ 6AQaC1u1xjlEpxtp5L0RiUzmoeXvoP+IUQgdoBNyyHPtGXX4Y9aSDm1gg7dJ718yMq fbsmrCFYdHhM0mVLre1S/FsaxdsWIaoPNmh/e14my490o1Hoxeo0QOvSY08oMCRLfp lybImiu1hOfynn0c322oLh4pP4Ib1m5uY7Fm5ebudA+hNv0VM3c2Sxmg/AwNi4jyyZ OJJb+wW7Valaw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Wt8fs3WN5z4wxJ; Tue, 27 Aug 2024 11:12:53 +1000 (AEST) Date: Tue, 27 Aug 2024 10:59:22 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] mbuto: Fix handling of binaries in /usr/libexec Message-ID: References: <20240826191156.1824065-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HXN3D1zf6CKwcos4" Content-Disposition: inline In-Reply-To: <20240826191156.1824065-1-sbrivio@redhat.com> Message-ID-Hash: VEDUR6YXFSZE4K2FKT3AN6F2TDHLTPOP X-Message-ID-Hash: VEDUR6YXFSZE4K2FKT3AN6F2TDHLTPOP 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: Sevinj Aghayeva , 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: --HXN3D1zf6CKwcos4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 26, 2024 at 09:11:56PM +0200, Stefano Brivio wrote: > The FHS says that binaries under /usr/libexec are not intended to run > directly on the host, and not, as I incorrectly assumed (probably from > some outdated distribution guidelines), on other hosts only: > https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html >=20 > If we move them to /usr/bin in the guest image, the helpers or > programs that are supposed to run those binaries might not find them. >=20 > We have, however, cases like /usr/libexec/qemu-kvm on some > distributions where we might have programs, on the host, which are > meant to run them, but we don't want to copy those to the guest image, > and we want to run the binary we copied from /usr/libexec directly. > This was the reason why I initially added this special handling. >=20 > Instead of doing that, simply add /usr/libexec to the guest's $PATH, > from the $FIXUP script. >=20 > Suggested-by: David Gibson > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > mbuto | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) >=20 > diff --git a/mbuto b/mbuto > index a2a8147..c2fffa0 100755 > --- a/mbuto > +++ b/mbuto > @@ -48,10 +48,13 @@ COPIES=3D"${COPIES:-}" > # Workers for time-consuming tasks such as stripping modules, see worker= s() > THREADS=3D"$(nproc)" > =20 > -# Fix-up script to run before /init, can be omitted > +# Fix-up script to run before /init, can be omitted. Note that we're add= ing > +# /usr/libexec to PATH because, while a given program might not be inten= ded to > +# directly run on the host (that's what /usr/libexec is for), we might n= eed to > +# run it directly on the guest instead. > [ -z "${FIXUP}" ] && FIXUP=3D'#!/bin/sh > =20 > -export PATH=3D/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sb= in: > +export PATH=3D/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sb= in:/usr/libexec: > =20 > mount -t proc proc /proc > mount -t sysfs sys /sys > @@ -752,14 +755,7 @@ prog_add() { > unset IFS > [ -z "${__bin}" ] && err "Can't source ${1}" > =20 > - # Binaries in /usr/libexec are meant to run on other hosts only, so they > - # can't reside in /usr/libexec on the target image. Move to /usr/bin. > - if [ "$("${DIRNAME}" "${__bin}")" =3D "/usr/libexec" ]; then > - __bindir=3D"${wd}/usr/bin" > - else > - __bindir=3D"${wd}$("${DIRNAME}" "${__bin}")" > - fi > - > + __bindir=3D"${wd}$("${DIRNAME}" "${__bin}")" > "${MKDIR}" -p "${__bindir}" > "${CP}" --preserve=3Dall "${__bin}" "${__bindir}" > =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 --HXN3D1zf6CKwcos4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbNJOkACgkQzQJF27ox 2Gdo3Q//QumeJ07Igr3IKMNXD4e7OJeYoSQozSuhOX1qxVZwIToHdTGFKMOlM6XU nc0DfiAVWDnCEgGhZTRZwNAfV5sD1+B2X0vMNmlN1jBNBjfiIlGWNFpdRlwpnHrs SxpnrYgjTFW8MWF4KRWLxwY9yQGPxVvDXc+Zi+cFOYnXzGbG6FbpAnRhv+3QCyeL UyVwe4HeZNV3oTYfp0SR1a/qQlou1FQtOKBloIsae5B8LPUrx7KG3IpLEVzG9Zse aw/VaKzNxl7TfSIGTjkfTK5XrPcG+ZM4OHz9gu8ahRCjVZHVXh7J/uUTHisKRw/T 3oxtcPtNb4764Lz/Wgwegl89VhczqPDXlj6JmNPK3xyefoCNEmVi39ElvEBwj+3t Q6cXWQxUa3tPMHs0ZhCwdJF+f2WR2qj0ahebRVdCP29BPIVdKrskG4iJOeW8ybWk NkWU7aSiVnBgBsbWEFv4FpEKtTPQBknKJh6ZfLxQXsDW/2OwpLRiBuKE7A8t8rK6 5Pq1/SdzaJ4xn4qQS9ySnBIcgQL5yyQucixGqJhiKHEQbEPQbtHtifvdl+z/90xs Aek98DlU4GgQAi2FzoQOXHNA1cKCGuhNM4gjs/IKNNh6lgK1Y5JEmUSrN2VFORSH yIj/fBODxwDeQdJWkFHEVjheNXgIJWsQAi9Vmn86heTnFfM/jJI= =mCCF -----END PGP SIGNATURE----- --HXN3D1zf6CKwcos4--