cat pages cache relies on terminal width rather than CATWIDTH option
I think I might have found an issue with man-db
cache. It seems that catpages are not stored nor read if terminal window width is not 80, regardless of my CATWIDTH
configuration.
I'm using:
- OS: Debian
- Version: 2.9.4
Here are my tests:
Set config in /etc/manpath.config
:
CATWIDTH 80
Using a terminal wider than 80 columns:
$ man -d tty
...
Terminal width 171
Terminal width 171 not within cat page range [80, 80]
...
This still correctly prints the catpage using the 80-column width configuration. Which makes me thing that it should also create a cache entry for it. However, there's no entry created for it in /var/cache/man/cat1
:
$ ls -la /var/cache/man/cat1 | grep "tty"
$
Using a terminal with exactly 80 columns:
After resizing my window to exactly 80 columns, I can see the cache entry in /var/cache/man/cat1
, after running the same command:
$ man tty
...
$ ls /var/cache/man/cat1 | grep "tty"
-rw-r--r-- 1 man man 728 Sep 24 2020 tty.1.gz
Strace
I manually removed the entries and ran both these scenarios in the following order using strace
on each call:
-
man tty
on wide terminal -> cache entry not created -
man tty
on 80c terminal -> cache entry created -
man tty
on wide terminal -> cache entry not read -
man tty
on 80c terminal -> cache entry read
Seems like /var/cache/man/cat1/tty.1.gz
is only accessed (both stat
and open
calls) if actual terminal is in the correct width.
From my understanding, man-db
should be able to create and read cache entries if CATWIDTH
is set, regardless of terminal window size. For example, if I like to display my man pages with 90 columns, it might make sense to store caches for that column width since that's the user's configuration.