The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8a5c836b51ce29fb22e0692c03fbc1e405c6522f

commit 8a5c836b51ce29fb22e0692c03fbc1e405c6522f
Author:     Ed Maste <[email protected]>
AuthorDate: 2023-08-01 18:00:48 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2023-08-02 20:46:57 +0000

    man: fix `man -K` search
    
    Quote re arg to grep in case it has spaces, and quote [:blank:] tr arg
    to avoid the shell interpreting [].
    
    PR:             272729
    Reviewed by:    Mina Galić <[email protected]>
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D41282
---
 usr.bin/man/man.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index 4fd6f886e87f..c95b47e2ee62 100755
--- a/usr.bin/man/man.sh
+++ b/usr.bin/man/man.sh
@@ -1000,11 +1000,11 @@ do_full_search() {
        gflags="${gflags} --label"
 
        set +f
-       for mpath in $(echo "${MANPATH}" | tr : [:blank:]); do
-               for section in $(echo "${MANSECT}" | tr : [:blank:]); do
+       for mpath in $(echo "${MANPATH}" | tr : '[:blank:]'); do
+               for section in $(echo "${MANSECT}" | tr : '[:blank:]'); do
                        for manfile in ${mpath}/man${section}/*.${section}*; do
                                mandoc "${manfile}" 2>/dev/null |
-                                       grep -E ${gflags} "${manfile}" -e ${re}
+                                       grep -E ${gflags} "${manfile}" -e 
"${re}"
                        done
                done
        done

Reply via email to