From nobody Sat Aug 30 22:02:54 2025 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 4cDpzL3Ndgz66Hgg; Sat, 30 Aug 2025 22:02:54 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cDpzL2fpgz3Jbw; Sat, 30 Aug 2025 22:02:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756591374; 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=0cOcHCXEDfO16aoOk4c4MQWxFC7rtldPAWmVTwHtVDk=; b=hD6eMwm3aw1nF2lx56QWMp5CKcMUPWb8ux9XOEY8qAxT2gJYG8D0dNJIoICLsnLz9AOcTf RDqN6EzIA7JVDw7qwTUHOegk7mVwITzu63sxwuXOZRWcUxLWLwSKQzAw1FTp7bSaAXh3ms YjQ/YHn/jpd19op/jNVSFsXVIWG08huQbZ2xTIHXETKfQ1tObg/EYvp0M4BCLRU5dWiYOx wwRNW1vf1onqF280Pf4nQkqJcG9QVkOAu9L/DzpGDgjId13UA+T4XGDnNQx4cZLOyzp5Ib Px/B+BKOQqghF7iDPPX5apwFUP1xY1rcBpVq8qOJ6kKDJmfvpCkctzmkB3TG4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756591374; 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=0cOcHCXEDfO16aoOk4c4MQWxFC7rtldPAWmVTwHtVDk=; b=Qnk7NkcGd62QqhxlhZhKot6TNnPHvh1n+hyrwvFccB7bi+itLBKuDiakx+HxaIDF2PMpGX z6ZsStXz9k+kK/ZI1OBOqBQSYfItGoVsnzSeTozkbTG+2wkfNm92vIXeMOQY2dDHKpBxVv T+dxUT7c8sYHb4crjLZd2rlfJihKq0NCZrruYZCNIysnyaa6HUWeb11l4NJ3Ih5DkYY0sC 90jksyOc+GYsKVIed2H9HZ4YukGaRW2lfY30WUJhpaP73HH62eQB1o4fhLyYcfN/s+bniu 1nDRLl4L46s9Zv/Ana3QuCMnVcFZfapOHBndSu3wUxhJa7TxDMsfLHjbSGGjJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756591374; a=rsa-sha256; cv=none; b=oXOoyD/2p5PihHMEk5YiAdJHAHznK0myCnCdsjAMkzhwBPtDAlMaShF5+r8RXnJ2sGfGTK cZOIeEZZG3Qjao5bZM7FAcwzfOakhAI6AOJBmDM6iAHw3s6+uFq86HGvqoAxe1mII/1njq H8uC3Ffh7ABwtbmPXB9aYfK/OA875TTpnjZrPlzY/7zsHaWSotLY2ZoMsKJRQ4qZZu4IYr fMQR/UWXsE3/jxrujf8YMLcC+5vpMVmVxIHoZtM7F/E4MYhTjB91Y4IBcYx8tJ0PVZ2uks hFov1K1VP88twehmV2UM3fLHy5ABXZZaKVcuDbUiuxwvsecnTUh2StE2rNQDjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cDpzL2FqSzlgB; Sat, 30 Aug 2025 22:02:54 +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 57UM2sJD085894; Sat, 30 Aug 2025 22:02:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57UM2sju085891; Sat, 30 Aug 2025 22:02:54 GMT (envelope-from git) Date: Sat, 30 Aug 2025 22:02:54 GMT Message-Id: <202508302202.57UM2sju085891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: fb37e38fbe99 - main - Revert "patch: fix pch_context() for unified diffs with no leading context" 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb37e38fbe99039a479520b4b596f4bfc04e2a88 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=fb37e38fbe99039a479520b4b596f4bfc04e2a88 commit fb37e38fbe99039a479520b4b596f4bfc04e2a88 Author: Kyle Evans AuthorDate: 2025-08-30 22:01:27 +0000 Commit: Kyle Evans CommitDate: 2025-08-30 22:02:35 +0000 Revert "patch: fix pch_context() for unified diffs with no leading context" This reverts commit f97b6a8f84b3ed209c2aea0958a7b889d0bf27ed, as it turns out our fuzz implementation is just too naive. We can have more leading context than trailing context and vice-versa, so we can't really assume they're the same. Restore the previous bug and we can work on it post-branch. Reported by: cy --- usr.bin/patch/pch.c | 2 +- usr.bin/patch/tests/unified_patch_test.sh | 21 --------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 9bc4599026ae..71f73125a8cb 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1054,7 +1054,7 @@ hunk_done: p_end = fillnew; malformed(); } - if (ch != ' ' && context >= 0) { + if (ch != ' ' && context > 0) { if (context < p_context) p_context = context; context = -1000; diff --git a/usr.bin/patch/tests/unified_patch_test.sh b/usr.bin/patch/tests/unified_patch_test.sh index a4b46ef34221..a91332908773 100755 --- a/usr.bin/patch/tests/unified_patch_test.sh +++ b/usr.bin/patch/tests/unified_patch_test.sh @@ -25,26 +25,6 @@ # SUCH DAMAGE. # -atf_test_case badfuzz -badfuzz_head() -{ - atf_set "descr" "Test for patch(1) erroneously fuzzing away action lines" -} -badfuzz_body() -{ - # PR 250511 demonstrates a scenario where patch(1) will happily apply a - # patch into the wrong location if we have some lines that are still - # similar in the trailing context. In the following example, it would - # actually replace the underscore before the second series of B\nC\nO - # with "Z", when the patch should have been rejected instead. - printf "A\nB\nC\nO\n_\nB\nC\nO\n" > file.orig - printf "Z\nB\nC\nO\n_\nB\nC\nO\n" > file - printf "OK\nDIFF1\nDIFF2\n\n_\nB\nC\nO\n" > file.newer - - atf_check -s not-exit:0 -o save:file.patch diff -u3 file.orig file - atf_check -s not-exit:0 -o not-empty patch file.newer file.patch -} - atf_test_case basic basic_body() { @@ -198,7 +178,6 @@ EOF atf_init_test_cases() { - atf_add_test_case badfuzz atf_add_test_case basic atf_add_test_case limited_ctx atf_add_test_case file_creation