Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2026 06:15:35 +0000
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
Subject:   git: 2434f3b279a9 - releng/14.4 - diff: Add test case for pagination resource leak
Message-ID:  <698c1e87.34313.4f3375c0@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch releng/14.4 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=2434f3b279a90f9a47a963d5898eea610a94f6e0

commit 2434f3b279a90f9a47a963d5898eea610a94f6e0
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-02-05 14:39:47 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-02-11 06:14:23 +0000

    diff: Add test case for pagination resource leak
    
    The pagination code leaks either processes or descriptors or both,
    depending on the exact version of the code you have.  Add a test case
    which exercises this leak to facilitate fixing it.
    
    Approved by:    re (cperciva)
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    thj, kevans
    Differential Revision:  https://reviews.freebsd.org/D55111
    
    (cherry picked from commit 270492602b9bd8b8fce4f021f055804978bf3f23)
    (cherry picked from commit 51c2384ce049ec92e07901cf8a84c171e5d72104)
---
 usr.bin/diff/tests/diff_test.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
index 453d82a4a3f3..2a07535d3d86 100755
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -403,6 +403,27 @@ bigu_body()
 	    diff -U$(((1<<31)-2)) a b
 }
 
+prleak_head()
+{
+	atf_set "descr" "Verify that pagination does not leak resources"
+}
+prleak_body()
+{
+	local n=32
+	mkdir a b
+	for hi in $(jot -w%02x $n 0) ; do
+		mkdir a/$hi b/$hi
+		for lo in $(jot -w%02x $n 0) ; do
+			echo "$hi$lo" >a/$hi/$lo
+			echo "$hi$lo" >b/$hi/$lo
+		done
+	done
+	ulimit -n 1000
+	ulimit -u 1000
+	atf_check diff -rul a b
+	atf_check diff -Astone -rul a b
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case simple
@@ -432,4 +453,5 @@ atf_init_test_cases()
 	atf_add_test_case dirloop
 	atf_add_test_case bigc
 	atf_add_test_case bigu
+	atf_add_test_case prleak
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698c1e87.34313.4f3375c0>