Page MenuHomeFreeBSD

man(1) fix to ".so" file redirection
Needs ReviewPublic

Authored by jamie_catflap.org on May 17 2024, 6:04 PM.
Referenced Files
Unknown Object (File)
Wed, May 29, 9:29 AM
Unknown Object (File)
Wed, May 22, 2:56 AM
Unknown Object (File)
Tue, May 21, 4:51 AM
Unknown Object (File)
Mon, May 20, 5:14 PM
Unknown Object (File)
Mon, May 20, 4:22 PM
Unknown Object (File)
Sun, May 19, 12:21 PM
Unknown Object (File)
Sun, May 19, 10:55 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

If you run man on a page that is redirected by a ".so " instruction, and your output is not going to stdout, man(1) now instead tries to cat the first file in your CWD.

Due to:

author Wolfram Schneider <wosch@FreeBSD.org> 2024-01-13 16:16:55 +0000
commit e3c7b76fa8105929ae9a785e5ffc44274b1b0a81

The changes here move the glob checking to the "is_exist" function.

However, in "man_check_for_so()", there is the line:

if ! check_man "$path/$tstr" ""; then

(because there is no corresponding "cat" page to check in this case.)

But now, "exists()" checks for the first glob match to ""* , hence matches the first file in the current directory.

A suggested fix is to modify "check_man()" to first check that the parameter is not null before continuing. (The attached patch does just that)

Obviously there are many places to fix this issue, so you may prefer to fix it within a different function! I have no beef with that!

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jamie_catflap.org retitled this revision from man(1) dix to ".so" file redirection to man(1) fix to ".so" file redirection.May 17 2024, 6:22 PM

Thanks for your report. I can reproduce the problem, depending on the current working directory. IMHO our system manual pages don't use .so anymore, so only some very few ports manpages are affected.

I think the correct fix is to check the first argument in the exists() function:

exists() {

if [ -z "$1" ]; then
  return 1
fi
[....]

}

Yeah, that's cool.. Probably clearer that way.

I didn't know .so wasn't wildly used - I just happened to stumbl on the issue with port net/libmaxminddb

Are you able to follow this up? I'm still unsure when a PR is better than a review, so sorry if I've messed up protocol.

Thanks,

I didn't know .so wasn't wildly used - I just happened to stumbl on the issue with port net/libmaxminddb

I saw the error on 38 manual pages from the ports collection, out of a of more than 120,000 manpages.

Are you able to follow this up? I'm still unsure when a PR is better than a review, so sorry if I've messed up protocol.

I recycled an old PR 275978, no need to open a new one. I consider the issue as resolved with 37be4197f72ae3a61bd5e93d2ebdc9bd6d09ed21

Are you able to follow this up? I'm still unsure when a PR is better than a review, so sorry if I've messed up protocol.

I recycled an old PR 275978, no need to open a new one. I consider the issue as resolved with 37be4197f72ae3a61bd5e93d2ebdc9bd6d09ed21

Brilliant! Thanks a lot