From nobody Wed May 27 22:59:05 2026 X-Original-To: dev-commits-src-main@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 4gQlRY6mfBz6fqjf for ; Wed, 27 May 2026 22:59:05 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQlRY4rFdz3kkL for ; Wed, 27 May 2026 22:59:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779922745; 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=mAEwckJTQOGE4Zk5oBN5gzIVgWY7B9L7wAvtu3VDXcQ=; b=ZYo/QNJKHGXHqI1Yfyos3TEP5o4F9O25NI9cR6AgPDmOr7cjIw8E9kieB3wxaHdS0sfG1C Q17+dRTmSLousdTbQ4JxWPwooilzSlwiSa7rVfTNBRLx0WDCrOiwhueKa4AaHZ7Hlgke9x uPZ9tRtBApPivGDFf0LLbv/Be1Ks3qyCnfk7xGOMQbJwkFONJmf+bA34W4eQzx0JZNag97 Ns3kHeGBWvwF8istr0nNQ8fcwae8WPKFQNXYQdvd7mnvzCCXc7eKtN0bSweS7ezkV0OY8O OXX89aKp6StXjXHSuzOge3MH2acbWtwMt+zPJCYnVr5NefyB6Z+xY1AYiAy4Rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779922745; a=rsa-sha256; cv=none; b=SVQxpNOmfkAGsEoZI28Vqq+dKF+hR5VFhKXFdncQinMTWVUxezhyn1fsfIh3qXmt3BHZod TdTQ38scY5ZPolj1+g/MM+8z9hGc2aVQ7JzLVrQCK5nSgJBiU6P9BO5RhNoqA0cfbKlIRW ygJfkNgD/l/imh+fcVM6kYMr78SGNTUf/Pk61EL5QilhaaasqoAxI5q72Abic4QT+OSBSa vBgLdhyzMcnjXio8g3cyILt2EXTqKwBlyAoejkxX0uhzywa0iG/XypFxLm9gQhz0OzDRHv hqIGkKZWPnpZ8L7ZAF4M70ECHYmcGN52pUSAIzOHa53qQuPZz2AdHd3+7b3PMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779922745; 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=mAEwckJTQOGE4Zk5oBN5gzIVgWY7B9L7wAvtu3VDXcQ=; b=oGA3UOMBV85PO+CgOJV6OSiRJPbxcGhdUPU7l11KnyKFikznGjAaGWXsWPhc3P680Le2OD Go1cCGQkk/d3hpVT9UaY+lxhuC/QY+DNXuMZYwWR1dmlxbAkZbdP0pyt9Kyr4dbpkmXJLs Tn6ikOdyXEeqFEBt+yiFjU2+vtoixE95AiJv94dMR41dTZ9D4znQ7aqVycfo81oG7K9G50 Q67LuuCFGvOwOy1O2g2HrT33SxFcgwOAqzXDinhvLoZrLKfd5iMR6mFDtScSeN1rdkKSO1 tE4SxU6Ic9K+InCWBq2hEUe0WejRYK098uyh4vNi6kiaP2l75LeBxxybV1wicQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQlRY3grNz4fV for ; Wed, 27 May 2026 22:59:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 341ea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 22:59:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aleksandr Rybalko Subject: git: 97cad013a50a - main - install: add -z option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ray X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97cad013a50a4012328e11424ed2350c1efc036c Auto-Submitted: auto-generated Date: Wed, 27 May 2026 22:59:05 +0000 Message-Id: <6a177739.341ea.6d7e7300@gitrepo.freebsd.org> The branch main has been updated by ray: URL: https://cgit.FreeBSD.org/src/commit/?id=97cad013a50a4012328e11424ed2350c1efc036c commit 97cad013a50a4012328e11424ed2350c1efc036c Author: Aleksandr Rybalko AuthorDate: 2026-05-25 07:53:20 +0000 Commit: Aleksandr Rybalko CommitDate: 2026-05-27 22:55:57 +0000 install: add -z option Introduces the -z flag, enabling users to set a custom file size limit for pre-installation change checks and avoiding future hard-coded limit modifications. Reviewed by: glebius Approved by: glebius (mentor) Obtained from: Fudo Security MFC after: 2 weeks Sponsored by: Fudo Security Differential Revision: https://reviews.freebsd.org/D57230 --- usr.bin/xinstall/Makefile | 2 +- usr.bin/xinstall/install.1 | 13 +++++++++++-- usr.bin/xinstall/xinstall.c | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile index fd95b97160fe..c05a50420c82 100644 --- a/usr.bin/xinstall/Makefile +++ b/usr.bin/xinstall/Makefile @@ -11,7 +11,7 @@ MAN= install.1 CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd -LIBADD= md +LIBADD= md util CFLAGS+= -DWITH_MD5 -DWITH_RIPEMD160 .ifdef BOOTSTRAPPING diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1 index c923321f20fe..169bf4ef11fe 100644 --- a/usr.bin/xinstall/install.1 +++ b/usr.bin/xinstall/install.1 @@ -33,7 +33,7 @@ .Nd install binaries .Sh SYNOPSIS .Nm -.Op Fl bCcpSsUv +.Op Fl bCcpSsUvz .Op Fl B Ar suffix .Op Fl D Ar destdir .Op Fl f Ar flags @@ -45,9 +45,10 @@ .Op Fl N Ar dbdir .Op Fl o Ar owner .Op Fl T Ar tags +.Op Fl z Ar size .Ar file1 file2 .Nm -.Op Fl bCcpSsUv +.Op Fl bCcpSsUvz .Op Fl B Ar suffix .Op Fl D Ar destdir .Op Fl f Ar flags @@ -59,6 +60,7 @@ .Op Fl N Ar dbdir .Op Fl o Ar owner .Op Fl T Ar tags +.Op Fl z Ar size .Ar file1 ... fileN directory .Nm .Fl d @@ -264,6 +266,13 @@ Cause .Nm to be verbose, showing files as they are installed or backed up. +.It Fl z Ar maxsize +Limit the comparison feature of +.Fl C +to files no larger than +.Ar maxsize . +Files exceeding this limit bypass the comparison step and are directly overwritten. +The default maximum size is 128MiB. .El .Pp By default, diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 1aed8c1b24e4..611274d0af68 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include "mtree.h" @@ -137,6 +138,7 @@ static FILE *metafp; static const char *group, *owner; static const char *suffix = BACKUP_SUFFIX; static char *destdir, *digest, *fflags, *metafile, *tags; +static size_t max_compare_size = MAX_CMP_SIZE; static int compare(int, const char *, size_t, int, const char *, size_t, char **); @@ -168,12 +170,13 @@ main(int argc, char *argv[]) u_int iflags; char *p; const char *to_name; + uint64_t num; fset = 0; iflags = 0; set = NULL; group = owner = NULL; - while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) != + while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uvz:")) != -1) switch((char)ch) { case 'B': @@ -270,6 +273,13 @@ main(int argc, char *argv[]) case 'v': verbose = 1; break; + case 'z': + if (expand_number(optarg, &num) != 0 || num == 0) { + errx(EX_USAGE, "invalid max compare filesize:" + " %s", optarg); + } + max_compare_size = num; + break; case '?': default: usage(); @@ -1092,7 +1102,7 @@ compare(int from_fd, const char *from_name __unused, size_t from_len, do_digest = (digesttype != DIGEST_NONE && dresp != NULL && *dresp == NULL); - if (from_len <= MAX_CMP_SIZE) { + if (from_len <= max_compare_size) { static char *buf, *buf1, *buf2; static size_t bufsize; int n1, n2; @@ -1484,11 +1494,11 @@ usage(void) { (void)fprintf(stderr, "usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n" -" [-M log] [-D dest] [-h hash] [-T tags]\n" +" [-M log] [-D dest] [-h hash] [-T tags] [-z maxcmpsize]\n" " [-B suffix] [-l linkflags] [-N dbdir]\n" " file1 file2\n" " install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n" -" [-M log] [-D dest] [-h hash] [-T tags]\n" +" [-M log] [-D dest] [-h hash] [-T tags] [-z maxcmpsize]\n" " [-B suffix] [-l linkflags] [-N dbdir]\n" " file1 ... fileN directory\n" " install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]\n"