* Alejandro Colomar <alx.manpages@xxxxxxxxx>, 2022-08-20 01:50:
Lintian, the Debian package checker, sets the MANROFFSEQ environment
variable to empty string as a speed optimization. This turns off
loading preprocessors that weren't explicitly declared in the
source. The lack of '\" comments can cause false positives (and
maybe also false negatives?) in Lintian.
The use of $MANROFFSEQ for Lintian was proposed here:
https://bugs.debian.org/677874
Beware that the man(1) man page does not correctly explain what
$MANROFFSEQ does: https://bugs.debian.org/971009
If we can have a test that makes sure the comment is accurate, I
wouldn't mind reintroducing it. If you would like to add a lint-*
target that tests pages to check that they have the comment iff they
need it, I'll accept it.
I guess that may be asking too much work. Maybe showing how to
reliably test it for a page would be enough (I could transform it into
a Makefile test). I can think of a small sh(1) script that could do
it, but is there any tool that already does it?
I'm not aware of anything like that, so I hacked up a script that runs
man twice, with and without empty MANROFFSEQ, and compares the results.
See the attachment.
It looks like in our case all the missing preprocessor declarations can
be added with this:
grep -l -x '^[.]TS$' man*/* | sort -u | xargs sed -i -e "1i'\\\\\" t"
--
Jakub Wilk
#!/bin/sh
set -e -u
if [ $# -eq 0 ]
then
printf 'Usage: %s FILE [FILE...]\n' "$0" >&2
exit 1
fi
for file
do
m1=$(sed -e 's/^[.]so .*//' "$file" | env -u MANROFFSEQ man -l -)
m2=$(sed -e 's/^[.]so .*//' "$file" | env MANROFFSEQ='' man -l -)
if [ "$m1" != "$m2" ]
then
printf '%s\n' "$file"
fi
done