From nobody Thu Jul 13 21:37:25 2023 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 4R27HT4N8Gz4mYMG; Thu, 13 Jul 2023 21:37:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R27HT2SJvz3t62; Thu, 13 Jul 2023 21:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689284245; 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=mj/WMHI9noQq/VbKlGGdzylt5UxZ4Fhw1feewu1IPPA=; b=uqOCGDUL1LT3KgoO2zNk+qBpcOzaUk9FMlXZP77husUXmK+Eurw5KkiAGEmAuBQmQkCOjz 5cvlpGR0mCNYHQ5Jif03/8bg2DcUIC5UnlQwN2TLSKERU0KLeKgPDKT8m531Vh+AnEhD1C BmcUVfYA2elgAZSg7h0ffTzWrGuiG/BoJlv2t3fBxQgQiOpx6D+J8VQtw6qxTZhdvNOqMU 4GMdmHuiTkCw3K0YCrsGi2WtI5aAas9V1kUK+Iiu3CQdxqFWPOO01Ycjmh6xCyRihNMEDV 677+2c7/QmaQWkYZx83qE0mzSG/+aGoLk5bbg0muy18DWCDtBBxljjS2NZSdRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689284245; 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=mj/WMHI9noQq/VbKlGGdzylt5UxZ4Fhw1feewu1IPPA=; b=YjLurHSH7VnEPkEcFbzcS0dS8xJwjPfchjYBHPg5oMiEhGkINamwI4v3QhjdwQ3s4Qn1Hx 5fIdzjk/LeYaRBb+tFK+7guHMU6+HX7vvQjiIH9h6U7cJVl3psPZP/aSevvkUiCUJqNnLG QdlQdMyvw1tuZj9htmtWJY2cwwjDwOFiR2WtplaO0d55SxArqFTFbAo/JcXoCwlQhhNyj8 feGyuPaEe2Vz5g+/HZvnqukXalLA2Y39IkIZyPzHfmlPI2duJIcwLuHfHXAei8k0gWfcyT xaytcivt3lIa3xS5Bv4RoQ0pm58DaqhdPlqvnRMgmMpIWOGbAjegOj3Tunsd4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689284245; a=rsa-sha256; cv=none; b=QFKtwHBhoUTIRZ60cacAsxAKBAnlyTFq/8v+wxi77SOVncwFuGAkVOt4nncTpqoPjsyI01 Zbedh3SxqlmF8ngkyY8p+jo/taAPl6bpmkV9WljZxrb/Q5ZcWz1soxsZZ4nwPUSELiQTxK Bo9VHQxfnhGEFnMmohMFGC8WgAkXoFelq1hlIWcuxsE/bcjR8XU70/SiCwbiKpxvLkUQqN 5eoBnuP+uzGj5N2QLYUbctp/HM/G590sSOLkt04WFmbmwnje3jEbikUOAzcD64MDJVceUX PFB2uO/8fNmJAkd2y5lObIN6ugb3ELzU6/yEH4Jrnsac7mcjmXqQPbVasuylKw== 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 4R27HT1XhPz16P1; Thu, 13 Jul 2023 21:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36DLbPV4022799; Thu, 13 Jul 2023 21:37:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36DLbPHh022798; Thu, 13 Jul 2023 21:37:25 GMT (envelope-from git) Date: Thu, 13 Jul 2023 21:37:25 GMT Message-Id: <202307132137.36DLbPHh022798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 1048a870e3b6 - main - xargs: disallow -R0 and -L0 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1048a870e3b6973a5be1193f3b45e6e867e8e1c0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=1048a870e3b6973a5be1193f3b45e6e867e8e1c0 commit 1048a870e3b6973a5be1193f3b45e6e867e8e1c0 Author: Daniel Tameling AuthorDate: 2023-07-13 20:06:31 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-07-13 21:35:23 +0000 xargs: disallow -R0 and -L0 Both cases were interpreted as these flags are unset. This meant that -R0 got converted to -R5 and that -L0 didn't have any effect at all. Since make at most 0 replacements isn't useful and since call utility for every 0 lines read doesn't make sense, throw an error for these two cases. MFC after: 1 week Reviewed by: des, kevans Differential Revision: https://reviews.freebsd.org/D41022 --- usr.bin/xargs/xargs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 94a32d04fd67..e6f8619bb8d1 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -174,7 +174,7 @@ main(int argc, char *argv[]) replstr = optarg; break; case 'L': - Lflag = (int)strtonum(optarg, 0, INT_MAX, &errstr); + Lflag = (int)strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) errx(1, "-%c %s: %s", ch, optarg, errstr); break; @@ -203,6 +203,8 @@ main(int argc, char *argv[]) Rflag = (int)strtonum(optarg, INT_MIN, INT_MAX, &errstr); if (errstr) errx(1, "-%c %s: %s", ch, optarg, errstr); + if (!Rflag) + errx(1, "-%c %s: %s", ch, optarg, "must be non-zero"); break; case 'r': /* GNU compatibility */