From nobody Mon Jul 21 07:25:31 2025 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 4blsPS37Hgz62HmX; Mon, 21 Jul 2025 07:25:32 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blsPR6zVfz3GNj; Mon, 21 Jul 2025 07:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753082732; 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=O7LKE2uSFw/+vnUt20ZnTCTT3vbH05z9NWuySsVtg74=; b=ey140/2DrEFF+C6eB+/hEZH85EN49JqbIl6TrvAGIELQCXMjzeTeMOTCd1O84NYF+6dbyM WNP5SpWwyTDhQdp41tnfr+YjVu38qmhXUWJyA8X8WqHDF/elmMsbB5d6rIpnyhw0AwZ/JW s/j7dsDWzsQec/Q875Y1aVOZ7/ZD39HytZVg/ZD/oUn2oIdd+4Q6JLKQd9MuqwoMOTHsCa GArqZJdYakyoGdcuRHC3MmefLvga7ox3ilJItNrFVLHgMnfP1Wsy4bJdJP3SqNdkaDCngt DwNkK/M8uUwbmNiVl68ukpyjPToAaQgqFMwQiH2OAtcBmlxdakhvZHhOdPqvgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753082732; 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=O7LKE2uSFw/+vnUt20ZnTCTT3vbH05z9NWuySsVtg74=; b=lp55dW/ujEAPhUkZ1bGcs/fCmXLUyYAGeY4m6Juu2gAb9WhKtlPzTP7iHQbKlNTQ8/vTgC +HMAbLXbugZvq7VHiG7EEr6wf7Np7RLGi+KTIr/07HLzDbSpVjkKhJWaAy3ppjO526yRzL xuG0/qIC4VbaVPh/SmxL8KStuzFnOh9O8e9nY62DIVTBXthjaMT1DUgLqzissiPI/Yipga qArPLHgZWjI6kaetARRIYkOnvUJdM+5XFljNKeOygvfYUNAVyfD9pVssAHt1wIrtnQJCfg Yl5auOteWfzlCa+Wm98ySzvxrnUw2RkfTCYFQR17BrTMEd9jEs9sl2ATAmhXcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753082732; a=rsa-sha256; cv=none; b=dSYgQlIFUtk3kCSnAkdNmz9b6R/vWVO2qnvkTHrIsrIOSkwECgQxZZRP92+Byfufto4GQF HX8kUbpySQnY5nC/XUO6Y8VLNeqy8Gcz0AzXm1Ind9WV7xFJ+q54stNnBYjaJC3F8etsNC 6z6HigZwnK9TozzqwYS+dZly8AffmSoAkqr3Lr54q18BOrEz1QVZ1X0rR3ibGdQahJtNt8 tYCaJSfsyg0bDSoVhjhuoi+oMQtg8imkyIl4iXIuN51XfVwtpKT/HCiWyhfc4fHJ8VRy+9 muNh4J/yizLJOp1y1VjG6r9WWtL1tSQoMbEczcbu2o0bv/+4sBt9TLQQTwyXYw== 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 4blsPR6495zpKK; Mon, 21 Jul 2025 07:25:31 +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 56L7PV7D003175; Mon, 21 Jul 2025 07:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L7PVqS003172; Mon, 21 Jul 2025 07:25:31 GMT (envelope-from git) Date: Mon, 21 Jul 2025 07:25:31 GMT Message-Id: <202507210725.56L7PVqS003172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: f8b632fb046d - main - man.sh: avoid endless loop 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8b632fb046de18f82705eddd5a11f91d54036df Auto-Submitted: auto-generated The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=f8b632fb046de18f82705eddd5a11f91d54036df commit f8b632fb046de18f82705eddd5a11f91d54036df Author: Wolfram Schneider AuthorDate: 2025-07-21 07:23:45 +0000 Commit: Wolfram Schneider CommitDate: 2025-07-21 07:23:45 +0000 man.sh: avoid endless loop limit the number of .so includes to a value of 32 instead of infinity. PR: 287037 Differential Revision: https://reviews.freebsd.org/D51412 --- usr.bin/man/man.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index ec20fc813bf4..18595042da5f 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -313,6 +313,8 @@ manpath_warnings() { # redirected to another source file. man_check_for_so() { local IFS line tstr + local counter_so=0 + local counter_so_limit=32 unset IFS if [ -n "$catpage" ]; then @@ -320,13 +322,16 @@ man_check_for_so() { fi # We need to loop to accommodate multiple .so directives. - while true + while [ $counter_so -lt $counter_so_limit ] do + counter_so=$((counter_so + 1)) + line=$($cattool "$manpage" 2>/dev/null | grep -E -m1 -v '^\.\\"[ ]*|^[ ]*$') case "$line" in '.so /'*) break ;; # ignore absolute path '.so '*) trim "${line#.so}" - decho "$manpage includes $tstr" + decho "$manpage includes $tstri level=$counter_so" + # Glob and check for the file. if ! check_man "$1/$tstr" ""; then decho " Unable to find $tstr" @@ -337,6 +342,10 @@ man_check_for_so() { esac done + if [ $counter_so -ge $counter_so_limit ]; then + decho ".so include limit of $counter_so_limit reached, stop" + fi + return 0 }