From nobody Sat Feb 03 01:36:18 2024 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 4TRZwz1p6Wz58kBZ; Sat, 3 Feb 2024 01:36:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRZwz1Gd5z4QZ6; Sat, 3 Feb 2024 01:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706924179; 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=VR8xeGlIjnI455tJwYOTCQlWleSYNh1gLRWepJ/zxMw=; b=q3Lec0oPH96ozqPc23cLeMKA34d02ci4YJ01+2tvsovwAy7LUeLosAlEWae7D0OYGP14Ht 9liV+4lrt39iqFjog/MW9nMYU6XvbH5OIG4aPsrNZrwWtmFgz8n14Zc0Imwj6LGWGx3J0+ uN2TnBebIlkPgPpjjUUKxGoIYBRCA9iiPaoymZSlJbpPox2xYDA2fuThtxla5el6y0HFL3 09cRag/xehTIkKr1lbXBuztxExVX8NpiHj/i/p6Y1tUKM+J5NVAW0aYH+WTWSiUEZYgfjQ 5ryKYg5mjcMtzmtsVEMtNyOpWnBdVKTIer0P0uoxA1C2Z/sConvS2T8fqX/+Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706924179; 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=VR8xeGlIjnI455tJwYOTCQlWleSYNh1gLRWepJ/zxMw=; b=KbIHpCGner38Gw2IOnCZUQMf64jzi31tW1zJ9V8eZhPGJQaG404m/0PFFOCJSssMz4mZ3d CDzpIeI0hz0OM9gPsSiLGaQB/7LcWDBQTPLAyB1BqwlidwNuG08UtW9iTYmJ+La30AkTJ1 Tanw2wvxfIEOOXuf3fxleWcetHwj4jNQccLf96SMQrS1WRsOm1Lql2cF3wFF1pWDdfGKnf YNRn0V7enEl/tL1YAaUFXCW0Q4fmPU44DN1aOibDNbmrxx8c/WV/65RIKU27wJD8Zgh2HO MVTs65x187FAh2OZyI7N1AexZm9KaZ6sTzL8WWebk45WGiFL87Ws2jCa20eSOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706924179; a=rsa-sha256; cv=none; b=bwCcJ7ZcN7jRmGBuQIi9eXdetuJszfvyNEiE+qSYz44xGbNfIkf6uaVRZr+6LfTRwDDBZY dVzJf9FunBuMQKi0Q+fsFCfs1cO5akKQ0D6V5d8okJh9aC/RAaK2uydwnLboMOJwowVl9M vGepssuFWgxNcYpY0SB2Z4qfZVepTDAO0ENnifhlDPCR6AKJHedcYwuBMEW4Xkl3zKD2wi ywZgni/CcmSvha1CqcgHre45UKzBEG6Gn24k3SlcDQmYs5uBK+1frCcltOOJ6DY55thAKG Ohk859SB0vBm08c1AOcxZ4flxtj+zTqdA8ou0s9X+CXUAFn0IhvRc9Pw9970tA== 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 4TRZwz0LFFztHB; Sat, 3 Feb 2024 01:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4131aIYd010632; Sat, 3 Feb 2024 01:36:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4131aIOj010629; Sat, 3 Feb 2024 01:36:18 GMT (envelope-from git) Date: Sat, 3 Feb 2024 01:36:18 GMT Message-Id: <202402030136.4131aIOj010629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e85a6f8dff96 - main - man: fix redirect for locales and file arguments 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e85a6f8dff96d33e7139a67f5b02dafaace0974c Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e85a6f8dff96d33e7139a67f5b02dafaace0974c commit e85a6f8dff96d33e7139a67f5b02dafaace0974c Author: Mohamed Akram AuthorDate: 2024-02-02 23:26:20 +0000 Commit: Warner Losh CommitDate: 2024-02-03 01:34:59 +0000 man: fix redirect for locales and file arguments Use the locale-specific path for localized pages and the appropriate parent directory for file arguments when handling redirects. Signed-off-by: Mohamed Akram Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1019 --- usr.bin/man/man.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index 4be38083462c..fd51648757a9 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -297,7 +297,7 @@ manpath_warnings() { fi } -# Usage: man_check_for_so page path +# Usage: man_check_for_so path # Returns: True if able to resolve the file, false if it ended in tears. # Detects the presence of the .so directive and causes the file to be # redirected to another source file. @@ -317,7 +317,7 @@ man_check_for_so() { .so*) trim "${line#.so}" decho "$manpage includes $tstr" # Glob and check for the file. - if ! check_man "$path/$tstr" ""; then + if ! check_man "$1/$tstr" ""; then decho " Unable to find $tstr" return 1 fi @@ -501,7 +501,12 @@ man_find_and_display() { unset use_cat manpage="$1" setup_cattool "$manpage" - if man_check_for_so "$manpage" "$(dirname \"$manpage"")"; then + p=$(cd "$(dirname "$manpage")" && pwd) + case "$(basename "$p")" in + man*|cat*) p=$p/.. ;; + *) p=$p/../.. ;; + esac + if man_check_for_so "$p"; then found_page=yes man_display_page fi @@ -520,7 +525,7 @@ man_find_and_display() { # Check if there is a MACHINE specific manpath. if find_file $p $sect $MACHINE "$1"; then - if man_check_for_so "$manpage" $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then @@ -534,7 +539,7 @@ man_find_and_display() { # Check if there is a MACHINE_ARCH # specific manpath. if find_file $p $sect $MACHINE_ARCH "$1"; then - if man_check_for_so "$manpage" $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then @@ -547,7 +552,7 @@ man_find_and_display() { # Check plain old manpath. if find_file $p $sect '' "$1"; then - if man_check_for_so "$manpage" $p; then + if man_check_for_so $p; then found_page=yes man_display_page if [ -n "$aflag" ]; then