From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id ABB285A0276 for ; Sat, 6 Apr 2024 05:11:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1712373076; bh=58yD4SzMIiiUwRHDjG3oO+hDQ9iGsVWfkxoQAC5kjYs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eNtq/TrlbAlJRYku4ERpGLWRYQJjHhIqth7QOHw11Um++kH4R2Se5xwe5xqbMV7MJ G1iw16vUXDc5A9hUJYXy/0oIqx5FElbzxeBtY+FgD5VWma4GjUVvHshg0/ovUIjUGu f2xUqsO3U+MIjuBCXRBBfCC76MfOw1k11EUOEoA+AqEJv6WvY1aZVnx2hrShDMOruE nYThN5uRQTzEQcVYR3JHjZ9i/1hioieEVkrVQ36IVfXKKkX6J5fyNovtMgczdtr5tl WkcwYRxOnRUKEzaKaMCGd8+hydeZ0WIGGj97Qp5sPHenSDiM6X3kmjonoKJDWEHncu RxpgcUL9hxWFA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VBL3S5Zwkz4wyV; Sat, 6 Apr 2024 14:11:16 +1100 (AEDT) Date: Sat, 6 Apr 2024 14:11:09 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 4/4] Remove unnecessary cpio_init function Message-ID: References: <20240322022739.2746102-1-david@gibson.dropbear.id.au> <20240322022739.2746102-5-david@gibson.dropbear.id.au> <20240405200853.49477dd0@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M87dVIGvTecovt9J" Content-Disposition: inline In-Reply-To: <20240405200853.49477dd0@elisabeth> Message-ID-Hash: ZIU7HF5CCD47B7SZ54TFISI7YFFNUZZP X-Message-ID-Hash: ZIU7HF5CCD47B7SZ54TFISI7YFFNUZZP 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: lvivier@redhat.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: --M87dVIGvTecovt9J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 05, 2024 at 08:08:53PM +0200, Stefano Brivio wrote: > On Fri, 22 Mar 2024 13:27:39 +1100 > David Gibson wrote: >=20 > > The cpio_init function is now only every called with the "discard" opti= on. > > But, moreover, what it does is create an initial mostly empty archive w= hich > > will just get overwritten by the final archive. > >=20 > > So, it's entirely unnecessary except for one subtlety. Our use of real= path > > when generating the final output requires that a file already exist in = the > > output location. We can fix that by shuffling some things out of a > > subshell, removing the need for realpath. > >=20 > > Signed-off-by: David Gibson > > --- > > mbuto | 31 ++++--------------------------- > > 1 file changed, 4 insertions(+), 27 deletions(-) > >=20 > > diff --git a/mbuto b/mbuto > > index 550f76e..0c51e18 100755 > > --- a/mbuto > > +++ b/mbuto > > @@ -544,28 +544,6 @@ subopts_get() { > > =20 > > ### CPIO #############################################################= ########## > > =20 > > -# cpio_init() - Source existing CPIO archive, or create if needed > > -# $1: Path to CPIO archive, might exist, might be discarded if existing > > -cpio_init() { > > - if [ -f "${OUT}" ] && [ "${1}" !=3D "discard" ]; then > > - info "Sourcing CPIO archive from ${OUT}" > > - > > - if ! "${GZIP}" -dfc "${OUT}" | > > - "${CPIO}" --quiet -iD "${wd}"; then > > - err "Invalid CPIO archive ${OUT}" > > - fi > > - else >=20 > This, and the second part of 1/4, remove a functionality which I > accidentally broke in commit b87e4f2e6595 ("mbuto: Create working > directory before profiles are sourced"): it was once possible to add > contents to an existing initramfs archive. Yeah, I didn't track it to a specific point, but I assumed that it was built to add to an existing archive in the past. It looked fairly thoroughly broken to me. > I guess I might be the only interactive user of mbuto at the moment, so I > got slightly annoyed by the fact it didn't work anymore but I didn't > really investigate further. I used it whenever an initramfs took more than > 5-10 seconds to build, and I'd keep forgetting to add stuff. So... in fact the kernel accepts not just a single cpio archive, but multiple. So rather than doing anything with archivemount or mangling the cpio, you could just append a secondary cpio with the additions. > Note that the help message still describes this mode of operation: >=20 > "Build initramfs image unless an existing one is passed." >=20 > and in the "Examples": >=20 > ./mbuto -f kata.img zsh_5.6.2-3_amd64.deb > Install zsh package to pre-existing kata.img Ah, yes, they should be updated to match. > but I also realised it's not convenient to have this as default, because, > especially for initramfs images that can be built faster, one might just > want to rebuild a single binary and the image, repeatedly. >=20 > Perhaps, instead of dropping this altogether, we could introduce a new > -K ("keep") option that skips the unconditional wd assignment and calls > cpio_init() (which becomes cpio_load() or something like that). >=20 --=20 David Gibson | 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 --M87dVIGvTecovt9J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmYQvUAACgkQzQJF27ox 2GeVtw//WbeQ4XshEYvwCkeTFNHEech64QjvnqmoNPVPgbky5K2QbjcClO8w8A29 psYH2lIA5w7+yojkTqXYJBGO1vQglTnpQ6K405qoOyheRbHDkYXuxMNrj2MuklCH BB81F8fXcwL5vvsavOPBj1HL0VDYxUR3QPQdS/1JquyL/zBRnCX+LXrN6juypO5C aFif/ll+acpFKWIqXfJeYu0jkZa9ggaRgEGuAoJrpoqHzXTwjRyAnwn1f/ydXivG SSLeL3ZS98orHdOy8U+SZVCgSDLeZfzdTZyNh7/u9gTdH66y5HpVGCqEuMkn0bcv zZ3prVBw4Gul5LX2KFsjJ1nATYF2cFCm7XHemyWpQmPTbKAbjx2l8G3tUo3dO0LQ VaG5lJRFXhIhU61eYqFSOWOkmFIcOJePcvuGu2H+/Ry4Mc8Qx/YNpSb8Y9QPht3M XnurDOI7SOIO8LgApRch7SjyjtkP4EBxtRqWljr8Ceg8AwrZgfFoRwMwQLZHUeBM eCZBepkBZGQ1T43FN4PvXHntYqUm+7jQ3MXpPVvEsDLvFCFvRIo0Ebvic8+Nw9R5 4gmEnsU2F+UBIrDFxTCZ5uQjtyRoeaR7AoCsqupxAfhHZcvgmpf7tRk9FVXRbW3V X5cz3B67wr72cX3Jiec7ef0eYCU8jxQcc3vKn5QKwm2YMtZO/3k= =aS8y -----END PGP SIGNATURE----- --M87dVIGvTecovt9J--