Subject: bug#77387: closed (Re: [bug#77387] [PATCH v2 1/2] man-db: Parse man macro arguments better.)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 11 Apr 2025 10:19:03 +0000

Your bug report

#77387: [PATCH 0/2] man-db: Better parsing of man macros.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77387: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77387
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#77387] [PATCH v2 1/2] man-db: Parse man macro arguments better.
From: Ludovic Courtès <[email-masked]>
To: Sergey Trofimov <[email-masked]>
Cc: Josselin Poiret <[email-masked]>, Simon Tournier <[email-masked]>, Mathieu Othacehe <[email-masked]>, Tobias Geerinckx-Rice <[email-masked]>, [email-masked], Christopher Baines <[email-masked]>
Date: Fri, 11 Apr 2025 12:05:58 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I applied v2, thank you!

I confirmed that this goes from:

--8<---------------cut here---------------start------------->8---
$ guix describe
Generation 342  Apr 06 2025 23:07:09    (current)
  shepherd d98d61a
    repository URL: https://git.savannah.gnu.org/git/shepherd.git
    branch: main
    commit: d98d61a8a3f20de46d18ce4a8af05c93fab20b89
  guile af96820
    repository URL: https://git.savannah.gnu.org/git/guile.git
    branch: main
    commit: af96820e072d18c49ac03e80c6f3466d568dc77d
  guix 6af6806
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 6af680670bf9055b90e6f8b63c4c2ab7b08e7c56
ludo@ribbon ~/src/guix$ guix shell man-db openssh -C -- man -k ssh
ssh (0)              - (unknown subject)
ssh-add (0)          - (unknown subject)
ssh-agent (0)        - (unknown subject)
ssh-copy-id (0)      - (unknown subject)
ssh-keygen (0)       - (unknown subject)
ssh-keyscan (0)      - (unknown subject)
ssh-keysign (0)      - (unknown subject)
ssh-pkcs11-helper (0) - (unknown subject)
ssh-sk-helper (0)    - (unknown subject)
ssh_config (0)       - (unknown subject)
sshd (0)             - (unknown subject)
sshd_config (0)      - (unknown subject)
--8<---------------cut here---------------end--------------->8---

… to:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix shell man-db openssh -C -- man -k ssh
ssh (1)              - (unknown subject)
ssh-add (1)          - (unknown subject)
ssh-agent (1)        - (unknown subject)
ssh-copy-id (1)      - (unknown subject)
ssh-keygen (1)       - (unknown subject)
ssh-keyscan (1)      - (unknown subject)
ssh-keysign (8)      - (unknown subject)
ssh-pkcs11-helper (8) - (unknown subject)
ssh-sk-helper (8)    - (unknown subject)
ssh_config (5)       - (unknown subject)
sshd (8)             - (unknown subject)
sshd_config (5)      - (unknown subject)
--8<---------------cut here---------------end--------------->8---

… which will undoubtedly be more convenient.  :-)

Thanks!

Ludo’.

Subject: [PATCH 0/2] man-db: Better parsing of man macros.
From: Sergey Trofimov <[email-masked]>
To: [email-masked]
Cc: Sergey Trofimov <[email-masked]>
Date: Sun, 30 Mar 2025 16:25:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hey guix, I've noticed that quite a lot man pages are reported to belong to a wrong section by `man -k`:

--8<---------------cut here---------------start------------->8---
$ man -k "" | grep "(0)"
...
ssh-pkcs11-helper (0) - (unknown subject)
ssh-sk-helper (0)    - (unknown subject)
ssh_config (0)       - (unknown subject)
sshd (0)             - (unknown subject)
sshd_config (0)      - (unknown subject)
sudo (0)             - (unknown subject)
sudo.conf (0)        - (unknown subject)
tc-cgroup (0)        - control group based traffic control filter
tc-connmark (0)      - (unknown subject)
...
--8<---------------cut here---------------end--------------->8---

A side-effect of it is that `M-x man` doesn't list such pages in auto-completion. I've attempted to fix that, see the following patch.

With the patch `man -k` and `M-x man` work properly:

--8<---------------cut here---------------start------------->8---
$ man -k sudo
cvtsudoers (1)       - (unknown subject)
sudo (8)             - (unknown subject)
sudo.conf (5)        - (unknown subject)
sudo_logsrv.proto (5) - (unknown subject)
sudo_logsrvd (8)     - (unknown subject)
...
--8<---------------cut here---------------end--------------->8---

Note, that synopsis extraction also needs improvement, however it turns out to
be more complicated as proper formatting requires cleaning up / expanding macros.

Sergey Trofimov (2):
  man-db: Parse man macro arguments better.
  man-db: Support mdoc-formatted man pages.

 guix/man-db.scm | 52 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 43 insertions(+), 9 deletions(-)

base-commit: 2ed28b5c24c599b2f9bc60dfc93151cf489ca477
-- 
2.49.0