From nobody Mon Oct 21 06:46:11 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XX5S40Z01z5YYy7; Mon, 21 Oct 2024 06:46:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XX5S35St5z4RTR; Mon, 21 Oct 2024 06:46:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729493171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cpjWdoJBlmWmdptmYbEw0hhIdG+Y55rQCiN2sBSqhxI=; b=gPOAp+CDPvEf3jXx+hZmaZykcmBb4mKI1GDOFRMWescT6zcsn2Oa3ichJlIUtSkPt7YNwb o/QHVNTzbKm3//FADkNBn3JSnacjmH07jaTWQ2NFHRJPiDdsGTvf0UU0SnBPf8xMB2YhE8 oYN/JfDZuQ/XhT2cEmKciUeRlTowmCHI94N30b7ObXAg+0Sj+4zWCEcyMeev5xR8bJp2eq geJx7bgedtzOk3/8uqPR/MA3PVgOsbfh7tuE9IOholARYJZYcJ96oXGWZHW+f8fnUvD5rU qL9Ck/y95X5smckCsJt6pFYrc3btr3W2e6WUqdT+QpwdpVKlvmrkkT3LQ41w+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729493171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cpjWdoJBlmWmdptmYbEw0hhIdG+Y55rQCiN2sBSqhxI=; b=nkbTQxxRKOxDFcHOy969Mit9WKf6tL6PJBF66Lu8F5xTOMWnwVDZF7RyWFegy6oFycnJjM KWYyUj5QbSm5zdFtbICi4/aJAq9GlmvQKLXq822c1XYwgYbRxiRSRQrYTqOENUwGh8wgzg XTG+CrjbdSCZ31yJIQdphv8cLbueNT7SXcBZcgED7qarAWNH6qplae4Rv25rOMIYBVNB9Q 46s6tQ2PyH1CRdXcc8X4SpZNkUzZuO5x6jrzVtG+EDncFV2zaA5TvvatjG4EzmQhpe9uQM FVEQPySqX33UE8qYXqmbf0H5Xk3beD57PQ0LxEWG6327xDZdBz0WouWDivn3xA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729493171; a=rsa-sha256; cv=none; b=pedGOHVArCWQITtFIYyAnR4WupXB9rf5npJW9GhmHg/JNl4EudLMAPuDg+l6U/nsASbQRt khezzXeNTTV4MkMbsSY43HZTPYWcl0pfjLkg8RyAp+A6xI8ad8JVywIEMswJxC3XI5o2/9 tXd5XMrtNCoa58wiSyzeiR4/ArZjSLGVPJQzxhvt9uSw8FvN0nZKxDBym1rCxrAboWmuy+ +cnGbl+OKmSyMWSoKqYXEG3odjvXQROEHetuBc3gxcjtFeFwlwcrqH9G8N3D8+gIVmkr2F V/G6cnUmgGNLTjNV6pGcGF4rIBMs6p3IqG8PeZkiDhkExpdWZ071Y1b8hQyE+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XX5S34yN4zJxr; Mon, 21 Oct 2024 06:46:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49L6kBdc013312; Mon, 21 Oct 2024 06:46:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49L6kBYJ013309; Mon, 21 Oct 2024 06:46:11 GMT (envelope-from git) Date: Mon, 21 Oct 2024 06:46:11 GMT Message-Id: <202410210646.49L6kBYJ013309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 525a177c1657 - main - mkuzip: drop support for executable uzip images List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 525a177c165740fc697df3de5b92e58b3b41477c Auto-Submitted: auto-generated The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=525a177c165740fc697df3de5b92e58b3b41477c commit 525a177c165740fc697df3de5b92e58b3b41477c Author: Robert Wing AuthorDate: 2024-10-21 06:43:41 +0000 Commit: Robert Wing CommitDate: 2024-10-21 06:45:09 +0000 mkuzip: drop support for executable uzip images A uzip image has a 128-byte header, historically, this header could be executed as a shell script to mount the uzip image to a user provided mountpoint. The embedded shell commands only work for uzip images that were created with zlib or zstd compression that contained an ISO-9660 file system. Given the limited space available in the uzip header, it is not practical to extend this feature to include other file systems or to provide sensible error handling and error messages to the user. For these reasons, abandon the embedded shell script in the uzip image header. To maintain backwards compatibility, the shebang and shell must reside in the 128-byte header. This change of behavior is documented in mkuzip(8) and an example has been provided for creating/mounting uzip images. PR: 276174 --- usr.bin/mkuzip/mkuz_lzma.h | 12 +++--------- usr.bin/mkuzip/mkuz_zlib.h | 4 +--- usr.bin/mkuzip/mkuz_zstd.h | 4 +--- usr.bin/mkuzip/mkuzip.8 | 45 ++++++++++++++++++++++++++++----------------- usr.bin/mkuzip/mkuzip.c | 2 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/usr.bin/mkuzip/mkuz_lzma.h b/usr.bin/mkuzip/mkuz_lzma.h index abdcc996e4c3..de7633c395ca 100644 --- a/usr.bin/mkuzip/mkuz_lzma.h +++ b/usr.bin/mkuzip/mkuz_lzma.h @@ -25,17 +25,11 @@ * SUCH DAMAGE. */ -/* Format L3.0, since we move to XZ API */ -#define CLOOP_MAGIC_LZMA \ - "#!/bin/sh\n" \ - "#L3.0\n" \ - "n=uncompress\n" \ - "m=geom_$n\n" \ - "(kldstat -m $m 2>&-||kldload $m)>&-&&" \ - "mount_cd9660 /dev/`mdconfig -af $0`.$n $1\n" \ - "exit $?\n" #define DEFAULT_SUFX_LZMA ".ulzma" +/* Format L3.0, since we move to XZ API */ +#define CLOOP_MAGIC_LZMA "#!/bin/sh\n#L3.0\n" + size_t mkuz_lzma_cbound(size_t); void *mkuz_lzma_init(int *); void mkuz_lzma_compress(void *, const struct mkuz_blk *, struct mkuz_blk *); diff --git a/usr.bin/mkuzip/mkuz_zlib.h b/usr.bin/mkuzip/mkuz_zlib.h index 88e68343a27d..5ecf77bb7284 100644 --- a/usr.bin/mkuzip/mkuz_zlib.h +++ b/usr.bin/mkuzip/mkuz_zlib.h @@ -26,9 +26,7 @@ #define DEFAULT_SUFX_ZLIB ".uzip" -#define CLOOP_MAGIC_ZLIB "#!/bin/sh\n#V2.0 Format\n" \ - "(kldstat -qm g_uzip||kldload geom_uzip)>&-&&" \ - "mount_cd9660 /dev/`mdconfig -af $0`.uzip $1\nexit $?\n" +#define CLOOP_MAGIC_ZLIB "#!/bin/sh\n#V2.0 Format\n" size_t mkuz_zlib_cbound(size_t); void *mkuz_zlib_init(int *); diff --git a/usr.bin/mkuzip/mkuz_zstd.h b/usr.bin/mkuzip/mkuz_zstd.h index b434afe61eee..ca62d3afd417 100644 --- a/usr.bin/mkuzip/mkuz_zstd.h +++ b/usr.bin/mkuzip/mkuz_zstd.h @@ -27,9 +27,7 @@ #define DEFAULT_SUFX_ZSTD ".uzst" -#define CLOOP_MAGIC_ZSTD "#!/bin/sh\n#Z4.0 Format\n" \ - "(kldstat -qm g_uzip||kldload geom_uzip)>&-&&" \ - "mount_cd9660 /dev/`mdconfig -af $0`.uzip $1\nexit $?\n" +#define CLOOP_MAGIC_ZSTD "#!/bin/sh\n#Z4.0 Format\n" size_t mkuz_zstd_cbound(size_t); void *mkuz_zstd_init(int *); diff --git a/usr.bin/mkuzip/mkuzip.8 b/usr.bin/mkuzip/mkuzip.8 index 6f7495ce5418..3b3afc626633 100644 --- a/usr.bin/mkuzip/mkuzip.8 +++ b/usr.bin/mkuzip/mkuzip.8 @@ -207,23 +207,6 @@ The same tradeoff continues to apply: reads in .Xr geom_uzip 4 become more expensive the greater the cluster size. .Pp -The -.Nm -utility -inserts a short shell script at the beginning of the generated image, -which makes it possible to -.Dq run -the image just like any other shell script. -The script tries to load the -.Xr geom_uzip 4 -class if it is not loaded, configure the image as an -.Xr md 4 -disk device using -.Xr mdconfig 8 , -and automatically mount it using -.Xr mount_cd9660 8 -on the mount point provided as the first argument to the script. -.Pp The de-duplication is a .Fx specific feature and while it does not require any changes to on-disk @@ -247,6 +230,34 @@ for .Dq 1 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +.Pp +The following describes how to create and mount a uzip image. +.Pp +Create a file system image: +.Bd -literal -offset indent +makefs /src.img /usr/src +.Ed +.Pp +Create the uzip image, the output file will be named src.img.uzip: +.Bd -literal -offset indent +mkuzip /src.img +.Ed +.Pp +Ensure geom_uzip is loaded: +.Bd -literal -offset indent +kldload geom_uzip +.Ed +.Pp +Create an MD device backed by the uzip image: +.Bd -literal -offset indent +mdconfig -f /src.img.uzip +.Ed +.Pp +Mount the uzip image: +.Bd -literal -offset indent +mount -o ro /dev/md0.uzip /mnt +.Ed .Sh SEE ALSO .Xr gzip 1 , .Xr xz 1 , diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c index f627562af7df..5d2aa9a48a98 100644 --- a/usr.bin/mkuzip/mkuzip.c +++ b/usr.bin/mkuzip/mkuzip.c @@ -298,7 +298,7 @@ int main(int argc, char **argv) toc[hdr.nblocks] = 0; cfs.fdw = open(oname, (cfs.en_dedup ? O_RDWR : O_WRONLY) | O_TRUNC | O_CREAT, - S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (cfs.fdw < 0) { err(1, "open(%s)", oname); /* Not reached */