Install the latest POSIX man pages

manposix

CentOS 6 (and probably most Linux distros) includes a man page section 1p for POSIX specifications.

man 1p sh, man 1p sed, et. al. are all very useful to be able to refer to for portable shell scripting.

However, I've just noticed that these man pages on my system are from the 2003 Open Group Base Specifications! Since then there have been the 2008 edition, the 2013 edition and the 2016 edition.

How can I make the latest POSIX specifications available offline as man pages on my Linux system?


I already attempted the following:

[vagrant@localhost ~]$ set -x
++ printf '\033]0;%s@%s:%s\007' vagrant localhost '~'
[vagrant@localhost ~]$ sudo yum upgrade $(rpm -qf $(man -w 1p sh))
+++ man -w 1p sh
++ rpm -qf /usr/share/man/man1p/sh.1p.gz
+ sudo yum upgrade man-pages-3.22-20.el6.noarch
Loaded plugins: fastestmirror, security
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
 * base: mirrors.evowise.com
 * extras: centos.sonn.com
 * updates: mirror.scalabledns.com
No Packages marked for Update
++ printf '\033]0;%s@%s:%s\007' vagrant localhost '~'
[vagrant@localhost ~]$ 

(On a related note: is there somewhere I can look up the differences of what exactly has changed between the 2003 edition and the 2016 edition?)

Best Answer

Man pages describe how the system actually functions, not how a standards body N years after the OS came out changed the standard. If Red Hat chose to ship POSIX 2003 man pages with their OS, I take that as meaning that's the closest POSIX standard to what they shipped.

I would leave the OS-provided POSIX man pages alone, but download the current versions, install them somewhere else like /usr/local/linux-man-pages/share/man, then put that directory into your MANPATH.

If you rename the p pages to have some other tag — say, pc for "POSIX current" — you can query them separately from the OS-provided ones. For example, you could use a tool like mmv:

$ mmv 'man1p/*.1p.gz' 'man1p/#1.1pc.gz'
$ mv man1p man1pc
  ... do the same for man 2p, etc ...
$ man ls              # shows GNU ls page
$ man 1p ls           # shows OS-provided POSIX ls page
$ man 1pc ls          # shows current POSIX ls page

Either remove the non-POSIX man pages that conflict with the OS-provided ones, or tag them similarly if you also want to be able to refer to current Linux-specific man pages. You could use lc for "Linux current", for example.

Related Question