Project

General

Profile

Feature #11477

`man` could strcasecmp the section name for `man <name>.<section>`

Added by Robert Mustacchi about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Today, most manual page sections are capitalized. This means that when man says to read something like shutdown(1M), one might think they could use man shutdown.1M. While man -s 1M shutdown does work. We've had a number of users stumble over this, so I decided to try and handle this case.

I've gone through and implemented this by saying that if we have a . in the file name after we've stripped off any compression suffix, that we make another copy of that string and transform this to an upper case version which we then do as an additional test. Note, this doesn't normalize the user's requested case, mainly that which was asked for in the file name. This means that if the user has asked for something like uio.3HEad, it won't work.

To test this I ran through a couple of variations here including the aforementioned shutdown.1M case. These include a number of variants on using -s, -a, and capitalizing the section name. These include:

$ ./man -s 9S uio
$ ./man -s 9s uio
$ ./man -s 9s uio.9s
$ ./man -s 9s uio.9S
$ ./man  uio.9S
$ ./man  uio   
$ ./man -a  uio$ ./man -a  uio.9S

History

#1

Updated by Garrett D'Amore about 1 month ago

I seem to recall at some point having man page sections that were not identical but differed only in case. I'd consider such a situation unfortunate, and I'm not aware that it exists today, but probably someone should double check.

#2

Updated by Robert Mustacchi about 1 month ago

Pages that double in case don't change at all. This is purely about the section that they're in. A uio(9S) and UIO and UiO(9S) and uIo(9S) and all other variations are independent and not impacted.

#3

Updated by Electric Monk about 1 month ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit 54f916c8df8cc80d841868fd67146743b1d266dc

commit  54f916c8df8cc80d841868fd67146743b1d266dc
Author: Robert Mustacchi <rm@joyent.com>
Date:   2019-07-19T16:56:37.000Z

    11477 `man` could strcasecmp the section name for `man <name>.<section>`
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF