Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2024 15:23:36 GMT
From:      Wolfram Schneider <wosch@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 47cb760dac09 - stable/14 - man: support special characters in filenames
Message-ID:  <202401311523.40VFNahI042366@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by wosch:

URL: https://cgit.FreeBSD.org/src/commit/?id=47cb760dac09ee10343e58cd46e923f27bd87f9b

commit 47cb760dac09ee10343e58cd46e923f27bd87f9b
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-01-25 07:14:06 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-01-31 14:47:33 +0000

    man: support special characters in filenames
    
    man.sh needs to handle double quotes and sub shell character
    as '`' '$' etc.
    
    PR:             275967
    Reviewed by:    bapt
    
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D43453
    
    (cherry picked from commit b8a484ec343d163a40f7cf4a6026e880f992c738)
---
 usr.bin/man/man.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index 777726f880db..cd047862727d 100755
--- a/usr.bin/man/man.sh
+++ b/usr.bin/man/man.sh
@@ -349,7 +349,7 @@ man_display_page() {
 				decho "Command: $cattool \"$catpage\" | $MANPAGER"
 				ret=0
 			else
-				eval "$cattool \"$catpage\" | $MANPAGER"
+				$cattool "$catpage" | $MANPAGER
 				ret=$?
 			fi
 		fi
@@ -374,7 +374,7 @@ man_display_page() {
 		pipeline="mandoc $mandoc_args | $MANPAGER"
 	fi
 
-	if ! eval "$cattool \"$manpage\" | $testline" ;then
+	if ! $cattool "$manpage" | eval "$testline"; then
 		if which -s groff; then
 			man_display_page_groff
 		else
@@ -387,10 +387,10 @@ man_display_page() {
 	fi
 
 	if [ $debug -gt 0 ]; then
-		decho "Command: $cattool \"$manpage\" | $pipeline"
+		decho "Command: $cattool \"$manpage\" | eval \"$pipeline\""
 		ret=0
 	else
-		eval "$cattool \"$manpage\" | $pipeline"
+		$cattool "$manpage" | eval "$pipeline"
 		ret=$?
 	fi
 }
@@ -480,10 +480,10 @@ man_display_page_groff() {
 	fi
 
 	if [ $debug -gt 0 ]; then
-		decho "Command: $cattool \"$manpage\" | $pipeline"
+		decho "Command: $cattool \"$manpage\" | eval \"$pipeline\""
 		ret=0
 	else
-		eval "$cattool \"$manpage\" | $pipeline"
+		$cattool "$manpage" | eval "$pipeline"
 		ret=$?
 	fi
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401311523.40VFNahI042366>