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.133.124]) by passt.top (Postfix) with ESMTP id AFC5F5A0276 for ; Fri, 5 Apr 2024 20:09:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712340570; 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=yFGVnb8yDf5A7QsuAYin/laD5MvTUG5A9l2umI7RDoY=; b=PiEqm9aETiW2jUGycjq4lje752vr1nWLFYejrCcyvLo36jUajuEw3EjUk9fFheDIua/fuO rmxwZRL9raN9to+tJ15vS/HQmbv9U67BwPNcyVRxhYAcTUWnuNmP2cMcNEkNk4bw00Zpsg 43pcNWTn3iS0Xtt2r1Dpoj4HPi4lkXk= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-116-T4nB-dZuMKO7GfnBp9hd2Q-1; Fri, 05 Apr 2024 14:09:29 -0400 X-MC-Unique: T4nB-dZuMKO7GfnBp9hd2Q-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-56e336ea7e0so521788a12.0 for ; Fri, 05 Apr 2024 11:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712340568; x=1712945368; 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=yFGVnb8yDf5A7QsuAYin/laD5MvTUG5A9l2umI7RDoY=; b=W/ZFXM7LQ53vTiC6IL0qXH+C6LT7uuxe+m5uPe9H2AT2NpqD7BRH2mPQVN27vrA818 hHvMeB39GuazGsgh+uxpI9MrRzh4ZWeDSYkwMbL3g/H7pmk/2ygDMUPX8eQHcn76bjXd UK2TDErMiCrlGQ+j31D6btw5qn+T9WEdPy98Wck+j/9iggoIiSCN1w4tCj7hLbX0iFG4 C+niLkEV8KdW5xdeqyCh5Ka5Jya/W+wPjB5EuHI4ydAXnmgmVkC6rFZ7Tp3RMjwU3BBJ DN7cC1OLrc5YgREAppfgWd2j5loImGoHkhSrYVM1UVLy9S7EBrezVNbCd2TET1vSZqvl C49A== X-Forwarded-Encrypted: i=1; AJvYcCXXenIoPKieir/zyyXhtwSdvTl4zBCPhP5lYRECEFevUS3yXNYDjI04/5OeSb9FHI/tsySD7e/sH2uD8Ki2wZdfQiyl X-Gm-Message-State: AOJu0YzH3kWraGVT5CAeCLnYRssw2EArHfr0MqBIdqoj4Hu32pdphUA8 un/SWtA2WQXmYxpgQ+fXpIUtj519vfazUQp8Bwo0+keEUVVKY8DFnof1X87MRTngNJUtnAKaFQ3 oEWpkqVBwM/wM80VtFGnAD1G+9T0S4sTtVIagK3XZBsB+43blEA== X-Received: by 2002:a50:8d19:0:b0:56d:f47c:5308 with SMTP id s25-20020a508d19000000b0056df47c5308mr1648746eds.34.1712340567866; Fri, 05 Apr 2024 11:09:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu5IEfMppWtW028nnVHZnu06vf6Sff/CwRgKMlz0kurixude5KcEJAKWj8RVvQ1aVSArwAEQ== X-Received: by 2002:a50:8d19:0:b0:56d:f47c:5308 with SMTP id s25-20020a508d19000000b0056df47c5308mr1648730eds.34.1712340567408; Fri, 05 Apr 2024 11:09:27 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id ec43-20020a0564020d6b00b0056e143857d2sm1007819edb.19.2024.04.05.11.09.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2024 11:09:26 -0700 (PDT) Date: Fri, 5 Apr 2024 20:08:53 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 4/4] Remove unnecessary cpio_init function Message-ID: <20240405200853.49477dd0@elisabeth> In-Reply-To: <20240322022739.2746102-5-david@gibson.dropbear.id.au> References: <20240322022739.2746102-1-david@gibson.dropbear.id.au> <20240322022739.2746102-5-david@gibson.dropbear.id.au> 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: BYVN753GXTGBB46FM2KZF2F3XTCT7A42 X-Message-ID-Hash: BYVN753GXTGBB46FM2KZF2F3XTCT7A42 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 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. 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. 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 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