diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-01-26 21:25:41 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-01-26 21:25:41 +0000 |
commit | 14efe2c6c823f2302db7cdafc7276a6e09676f85 (patch) | |
tree | bfe0fca3300b20f5a153bd3e336586e4c68cf8c5 /configure.local.example | |
parent | ff5d1b6807b6b1831313e20d894e7761bf88f864 (diff) | |
download | mandoc-14efe2c6c823f2302db7cdafc7276a6e09676f85.tar.gz |
Repair more of the issues that i found in filescan() while investigating
the report from <Andreas dot Kahari at abc dot se> on ports@:
For a symlink, use the first of the following names that is available:
1. In -t mode, the symlink itself (unchanged).
2. When the (unresolved) symlink already resides inside the manpath,
just strip the manpath and use the rest (unchanged).
3. When prefix(es) of the unresolved symlink point to the manpath,
strip the longest such prefix and use the rest (new); this fixes
situations where the manpath or one of its parent directories is a
symlink and at the same time contains symlinks to manual pages.
4. Fall back to the fully resolved symlink, with the manpath stripped
(new); this may for example happen when the command line passes
symlinks from outside the manpath that point to manual pages inside
the manpath, or if manual page trees contain symlinks to symlinks and
not all of them are given on the command line.
The fallback (4) isn't perfect. You can construct symlink spaghetti
in such a way that this algorithm will not enter all manual page
names into the database that a human would be able to deduce. But
i do not expect such spaghetti to actually occur in practice (not
even in ports), and a full fix would require re-implementing
realpath(3) in terms of step-by-step readlink(2) calls, repeating
the complicated algorithm (3) after each step.
While here, also stop using PATH_MAX as the size of a static buffer
in filescan(); on some systems, it can be unreasonably large.
Instead, allocate path strings dynamically.
Diffstat (limited to 'configure.local.example')
0 files changed, 0 insertions, 0 deletions