From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id C9C6B5A026D for ; Thu, 25 Apr 2024 06:47:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714020429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WjUDjqie8KdmsGly8V4cXT24kA04dmOJBqphGuFIhWE=; b=U4lomPwu3Guzsl6Q7V9A0hIhBw/e/dx9CLmv1kChaykhupxzYZ64kE/nSzqTYfqskiube3 Glmj6qktdRM72nFJJpQgltl+N3nAgcbbxhEa+OKGUMdhEzwgxBXb7IwHGsz0pwX2XJ+tto 5Swohh6RmQSliYGxJypZFjGUvpv2tKY= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-Aa6KT4vcPSWLATUyLb70kQ-1; Thu, 25 Apr 2024 00:47:07 -0400 X-MC-Unique: Aa6KT4vcPSWLATUyLb70kQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a58030927e5so28700966b.2 for ; Wed, 24 Apr 2024 21:47:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714020426; x=1714625226; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WjUDjqie8KdmsGly8V4cXT24kA04dmOJBqphGuFIhWE=; b=aWOX+fmI3WT9SHPMXmuFjvUDrOgMQVZ7FLG0qaufsbfDj8xzM8zDCmbLkOm2nbwTrT 0+gux4sDOnv/yKwBO+1WB2Mtgg7F+K8MXTDQdPOO7G4KWFq1zKfENyC+oDm29nGy/zKz TOwWYAnB5f+OayMh4d3X8OI9vKPUr1kWw7hkXNkG6lA3XcXBnCbor55qONIhhV63yI1v LmGCs4uhAHPXeHkzU+EBWm0ypZy39th/XZOIr2CGo6bUuEvNUXay20K2BKCdq6Li9qQg Df87lzcMJ70H62pemnih2909vX/T5rACiENeyTag+V+VRh5gaRSd8NbbS92Xem4gkikm KjVA== X-Forwarded-Encrypted: i=1; AJvYcCXLUgNVa2IY2nD5EE55rGbejRgq4YyY+Gbl9fN11qBrDt8RUmJzqtqcyV/iOfNhkLk5KYB3suDQSd/HgxfdXCCUjBZi X-Gm-Message-State: AOJu0YwIe4svdpcuSm6+4Ip62BMeXmdRu1DBF81N5H6EahDFbAkq30P6 f6e1hI9EQ/ljJapbXajEw/a9llj9gHK1NCXZ/vERlJaUyFu316Nj+Mk9QHRBS4ChLUd+Olkkrhk 0vWFPhBwKxT5P1fWjJD8au4/nJ8iz24uudNaeyrnwjXTs33lvUxJRInOtfAkk X-Received: by 2002:a17:906:474a:b0:a58:8fc0:fbca with SMTP id j10-20020a170906474a00b00a588fc0fbcamr2650601ejs.45.1714020425747; Wed, 24 Apr 2024 21:47:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFf/qpq7xIKVtMtym2zpjr6YykDtazS8rv23ZkMK0Hp2f2TcPMONW7Khs7oLFMmSX5LswwNaA== X-Received: by 2002:a17:906:474a:b0:a58:8fc0:fbca with SMTP id j10-20020a170906474a00b00a588fc0fbcamr2650591ejs.45.1714020425257; Wed, 24 Apr 2024 21:47:05 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id dk19-20020a170907941300b00a55a5384986sm5687196ejc.24.2024.04.24.21.47.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2024 21:47:04 -0700 (PDT) Date: Thu, 25 Apr 2024 06:46:30 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 4/4] Remove unnecessary cpio_init function Message-ID: <20240425064630.65ab8f24@elisabeth> In-Reply-To: References: <20240322022739.2746102-1-david@gibson.dropbear.id.au> <20240322022739.2746102-5-david@gibson.dropbear.id.au> <20240405200853.49477dd0@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: GFRT7GL7KFBO56QEICFPTSJ7F23ZIIU7 X-Message-ID-Hash: GFRT7GL7KFBO56QEICFPTSJ7F23ZIIU7 X-MailFrom: sbrivio@redhat.com 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: On Sat, 6 Apr 2024 14:11:09 +1100 David Gibson wrote: > 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: > > > > > The cpio_init function is now only every called with the "discard" option. > > > But, moreover, what it does is create an initial mostly empty archive which > > > will just get overwritten by the final archive. > > > > > > So, it's entirely unnecessary except for one subtlety. Our use of realpath > > > 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. > > > > > > Signed-off-by: David Gibson > > > --- > > > mbuto | 31 ++++--------------------------- > > > 1 file changed, 4 insertions(+), 27 deletions(-) > > > > > > diff --git a/mbuto b/mbuto > > > index 550f76e..0c51e18 100755 > > > --- a/mbuto > > > +++ b/mbuto > > > @@ -544,28 +544,6 @@ subopts_get() { > > > > > > ### CPIO ####################################################################### > > > > > > -# 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}" != "discard" ]; then > > > - info "Sourcing CPIO archive from ${OUT}" > > > - > > > - if ! "${GZIP}" -dfc "${OUT}" | > > > - "${CPIO}" --quiet -iD "${wd}"; then > > > - err "Invalid CPIO archive ${OUT}" > > > - fi > > > - else > > > > 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. Well, minus that change, that was the only way I used this tool for a while. > > 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. Okay, good to know, but at least at a glance, I couldn't find out how to do this. I suppose we would need to decompress and compress the archive anyway, right? > > Note that the help message still describes this mode of operation: > > > > "Build initramfs image unless an existing one is passed." > > > > and in the "Examples": > > > > ./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. Right, with this updated I'm fine with this patch (and with the whole series with my comment to 3/4 addressed). I'm still convinced we should fix that and add it back, but it's not made more complicated by removing it now. > > 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. > > > > 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). -- Stefano