From nobody Fri Feb 16 12:50:52 2024 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 4TbsHJ6MP6z5BpFP; Fri, 16 Feb 2024 12:50:52 +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 4TbsHJ37pQz4VPk; Fri, 16 Feb 2024 12:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708087852; 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=6kR0Pk2zKleYrP2gCYVuSG7d6YxEjsPDvCMi2F+jfcM=; b=JPtfYzoiXQmVVVZXmlJsM+h09PvQL3WkruTZmLHDCHspxrDF4gKBC+/wGi+le+ZGzS1mk4 hySQVt6r0jJmBFs9zz+e9llf11V+55UcZIVyyE3Xb+drVmX3cUbVV7ELE3GgXyd2Yv20EJ oDSCVpyq1A5uuXutLhgsOqIx9YUXDv4fFmSQBy0/83HcXWokOzfKQrPegsMNsQljTkSBi9 ctw0fKJWGDJSj/iWAqmD9L0jHYEK28y2/zMUPXEQJhCmt+E7AA0kM/8Us02JiqyqLYcxjv RdYgIltY5yEKslCdmj+6FGMCi35rNA7WNDdtxZBmj7ianw7FwmGxB443r4fqFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708087852; 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=6kR0Pk2zKleYrP2gCYVuSG7d6YxEjsPDvCMi2F+jfcM=; b=x2t6dsiXzPLg67I1bPD6JhHWVp+gqW2yh67vfJXX5NVo2JL05C8tEIHQkndcqXHqlHKY97 4/JI5GRLZ7+kqKeNX/I9YsTDttDHDBQbr2+lGMGslZMxNtML+rH1qVJTmuPsb5yePRF9kP Iz0rJ+Ubo/03+aT/fjXtQu7u5llL8GCMP/X2tdjs+8yabjbauxbBXIQFsZKBxkm2FNAqbX cIIMQc63eOtwvJ8F8bH39RIesrc6hhrOM3anVMg6XFcqQStgP9+3T0Ou7XmCmb5h5YhDAP PuZ6CPBLhjBL2axSaTGenPc5JQgg+dzakkOY93kV544Fe0gGF4lLbZ2fFQ4IgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708087852; a=rsa-sha256; cv=none; b=XEoYM2D9dxnzmtTST60GyseqO/7wQ4eS7qSzAhiqaNS1loihzwEgf+hxoqKR7G2R1D7Rz7 5LmiVvJrbK2iTnj1nv9tplpJiTHQIOqJou5YXbI8D6z59mWYZ8J2ZF0N0pB2et/UQq3Fb1 NZ3EyJ7LNUzg5XJALzXgFvQfy6YJgTAzYbRAOdvc2aKeqXRj+KZbm7t01QVcDE7T01SqFj 1fSqwggM3VNU1i+biuflWUZuIRXaRJgdI1ZL9depTA0N4aGGPi3cprD/7TiJP621CBx44P TpH5cj9fwla3elN42cYqTI+z1cPxKHMSGwa01lre+r+XMFc3DaRfwuWaiOrmPQ== 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 4TbsHJ2FNczQMR; Fri, 16 Feb 2024 12:50:52 +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 41GCoqXl013826; Fri, 16 Feb 2024 12:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41GCoqB0013823; Fri, 16 Feb 2024 12:50:52 GMT (envelope-from git) Date: Fri, 16 Feb 2024 12:50:52 GMT Message-Id: <202402161250.41GCoqB0013823@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 5b44edb40583 - main - md5: Ignore files in string and passthrough mode. 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: 5b44edb4058365ba8e4ccfdb5176c1cddd4394fe Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=5b44edb4058365ba8e4ccfdb5176c1cddd4394fe commit 5b44edb4058365ba8e4ccfdb5176c1cddd4394fe Author: Dag-Erling Smørgrav AuthorDate: 2024-02-16 12:37:04 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-02-16 12:37:36 +0000 md5: Ignore files in string and passthrough mode. MFC after: 1 week Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D43871 --- sbin/md5/md5.1 | 2 ++ sbin/md5/md5.c | 2 +- sbin/md5/tests/md5_test.sh | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index a17ef5ae30b7..0a8dc46f3b1f 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -129,6 +129,7 @@ option, the calculated digest is printed in addition to the exit status being se .Pq Note that this option is not yet useful if multiple files are specified. .It Fl p , -passthrough Echo stdin to stdout and append the checksum to stdout. +In this mode, any files specified on the command line are silently ignored. .It Fl q , -quiet Quiet mode \(em only the checksum is printed out. Overrides the @@ -146,6 +147,7 @@ options. .It Fl s Ar string , Fl -string= Ns Ar string Print a checksum of the given .Ar string . +In this mode, any files specified on the command line are silently ignored. .It Fl t , Fl -time-trial Run a built-in time trial. For the diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index 29f212148ce3..2045b623ff57 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -606,7 +606,7 @@ main(int argc, char *argv[]) err(1, "Unable to enter capability mode"); #endif - if (*argv) { + if (*argv && !pflag && string == NULL) { do { const char *filename = *argv; const char *filemode = "rb"; diff --git a/sbin/md5/tests/md5_test.sh b/sbin/md5/tests/md5_test.sh index 6b00a6b102c4..5b018b18c220 100644 --- a/sbin/md5/tests/md5_test.sh +++ b/sbin/md5/tests/md5_test.sh @@ -204,6 +204,8 @@ bsd_${alg}_vec${i}_body() { for opt in -q -qr -rq ; do atf_check -o inline:\"\$out_${i}_${alg}\n\" ${alg} \${opt} in done + atf_check -o inline:\"\$inp_${i}\$out_${i}_${alg}\n\" ${alg} -p