TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.57k stars 246 forks source link

OS-8436 improve man.cf sorting #1103

Closed jclulow closed 3 months ago

jclulow commented 3 months ago

This PR substantially reworks the previous somewhat incomplete ordering engine. It performs a crude topological sort, using something that resembles the depth-first search algorithm if you keep the lighting turned low.

It sorts the list in the way that I think makes the most sense, given the section number rejiggery:

#
# This file is automatically generated by the "mancf" tool
# in "smartos-live.git".  It affects the search order of
# manual page sections for pages shipped in "/usr/share/man".
#
# NOTE: All sections must be listed in this file, or they will
#       NOT be searched.  See man(1) for more details.
#
MANSECTS=1,1c,8,1b,2,3,3c,3avl,3bsm,3c_db,3cfgadm,3commputil,3contract,3cpc,3curses,3dat,3devid,3devinfo,3dlpi,3dns_sd,3elf,3exacct,3ext,3fcoe,3fstyp,3gen,3gss,3jedec,3kstat,3kvm,3ldap,3lgrp,3lib,3m,3mail,3malloc,3mp,3mpapi,3mvec,3nsl,3nvpair,3ofmt,3pam,3papi,3picl,3picltree,3pool,3proc,3project,3resolv,3rpc,3rsm,3sasl,3scf,3sec,3secdb,3sip,3socket,3head,3stmf,3sysevent,3tecla,3utempter,3uuid,3vnd,3volmgt,3x11,3xau,3xaw,3xcurses,3xext,3xmu,3xnet,4,4d,4fs,4i,4ipp,4m,4p,5,5b,7,9,9e,9f,9p,9s,

Critically: 8 is before 1B, but after all other subsections of 1. 3C appears first amongst subsections of 3, but not before 3 itself. 3HEAD appears right after 3SOCKET. Everything else is sorted lexicographically.

Hopefully the comments make it a bit easier to understand how to change it in future.

danmcd commented 3 months ago

Building a PI with this right now. Will report back results.

danmcd commented 3 months ago

Building a PI with this right now. Will report back results.

The sample man.cf here works. The results that are left to report will be if this build generates the same one (it should).

danmcd commented 3 months ago

PI-built man.cf matches one here in example.