<table><tr><td style="">marten created this revision.<br />marten added a reviewer: Plasma.<br />Restricted Application added a project: Plasma.<br />Restricted Application added a subscriber: plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9033" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>That page, and many others, links to another page with just a plain name:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">.so PAM.8</pre></div>
<p>This is read by man2html and passed to MANProtocol::readManPage() with a filename of "../PAM.8". This is then resolved against the containing directory "/usr/share/man/man8", becoming "/usr/share/man/PAM.8". No such file exists and the mandir.entryList().first() asserts because the list is empty.</p>
<p>The relative filename is correct in the case of other pages. e.g. telinit(8) which uses:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">.so man8/init.8</pre></div>
<p>So it is not enough to simply ignore the "..". The change to man2html here attempts to correct the reference by detecting whether it is of the form "../page.sect" and is not "../manN/page.sect", and removing the ".." component only in the first case.</p>
<p>While investigating this I found it useful to have a better diagnostic if the .so page could not be found. The change here to kio_man.cpp detects that case and displays an error page instead of asserting. This should only happen if there is a bug in the man page, but it is useful to have a pointer so that the upstream man page can be fixed.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Built kio_extras with this change. Verified correct display of the man pages:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">man:/pam(8) - simple page name
man:/service(8)
man:/telinit(8) - relative page name with section
man:/vigr(8)
man:/mq_open(2) - relative page name to another section</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R320 KIO Extras</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9033" rel="noreferrer">https://phabricator.kde.org/D9033</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>man/kio_man.cpp<br />
man/man2html.cpp</div></div></div><br /><div><strong>To: </strong>marten, Plasma<br /><strong>Cc: </strong>plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>