<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/116604/">https://git.reviewboard.kde.org/r/116604/</a>
     </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 5th, 2014, 3:36 p.m. UTC, <b>Burkhard Lück</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://git.reviewboard.kde.org/r/116604/diff/1/?file=252003#file252003line170" style="color: black; font-weight: bold; text-decoration: underline;">src/meinproc.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int main(int argc, char **argv)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">170</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#ifndef Q_OS_WIN</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">171</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="c1">// libxslt parses the path given to outputFile as XPath expression which fails</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">172</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="c1">// see libxslt/xsltEvalUserParams</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">173</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="c1">// this parameter is used only by share/kdoctools5/docbook/xsl/html/math.xsl</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">174</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="c1">// and is not supported on windows yet</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">175</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">if</span> <span class="p">(</span><span class="n">parser</span><span class="p">.</span><span class="n">isSet</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span class="s">"output"</span><span class="p">)))</span> <span class="p">{</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">176</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">params</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">qstrdup</span><span class="p">(</span><span class="s">"outputFile"</span><span class="p">));</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">177</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">params</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">qstrdup</span><span class="p">(</span><span class="n">parser</span><span class="p">.</span><span class="n">value</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span class="s">"output"</span><span class="p">)).</span><span class="n">toLocal8Bit</span><span class="p">().</span><span class="n">constData</span><span class="p">()));</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">178</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="p">}</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">179</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#endif</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">How does this affect this code in KHelpcenter:

kde-runtime/khelpcenter/glossary.cpp:149:    KProcess *meinproc = new KProcess;
kde-runtime/khelpcenter/glossary.cpp:153:    *meinproc << KStandardDirs::locate( "exe", QLatin1String( "meinproc4" ) );
kde-runtime/khelpcenter/glossary.cpp:154:    *meinproc << QLatin1String( "--output" ) << m_cacheFile;
kde-runtime/khelpcenter/glossary.cpp:155:    *meinproc << QLatin1String( "--stylesheet" )
kde-runtime/khelpcenter/glossary.cpp:157:    *meinproc << m_sourceFile;
kde-runtime/khelpcenter/glossary.cpp:176:    KProcess *meinproc = static_cast<KProcess *>(sender());
kde-runtime/khelpcenter/toc.cpp:148:    KProcess *meinproc = new KProcess;
kde-runtime/khelpcenter/toc.cpp:152:    *meinproc << KStandardDirs::locate("exe", "meinproc4");
kde-runtime/khelpcenter/toc.cpp:153:    *meinproc << "--stylesheet" << KStandardDirs::locate( "data", "khelpcenter/table-of-contents.xslt" );
kde-runtime/khelpcenter/toc.cpp:154:    *meinproc << "--output" << m_cacheFile;
kde-runtime/khelpcenter/toc.cpp:155:    *meinproc << m_sourceFile;
kde-runtime/khelpcenter/toc.cpp:172:    KProcess *meinproc = static_cast<KProcess *>(sender());

About the issue with dot in Path see also
http://lists.kde.org/?l=kde-doc-english&m=127421104303628&w=2</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes, the bug is the one reported in that email. It has been filed as bug https://bugs.kde.org/show_bug.cgi?id=246755 (I set it in this RR).
The problem was that the value was passed without quotes as parameter to the the function in libxslt. But on the other side it is not used, because the output of the stylesheet is stored in a string and then written in a file (see transform function in xslt.cpp), so it's pointless to pass it.
</pre>
<br />




<p>- Luigi</p>


<br />
<p>On March 5th, 2014, 1:06 a.m. UTC, Luigi Toscano wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Documentation, KDE Frameworks, kdelibs, and Aleix Pol Gonzalez.</div>
<div>By Luigi Toscano.</div>


<p style="color: grey;"><i>Updated March 5, 2014, 1:06 a.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://bugs.kde.org/show_bug.cgi?id=246755">246755</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdoctools
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The outputFile parameter is not used by the stylesheets, so don't pass it. If a directory starts with ".", it is interpreted in a wrong way by libxslt with an error like:
-------------------
XPath error : Invalid expression
/home/kde-devel/.cache5/khelpcenter/help/__home__kde-
devel__kde__share__doc__HTML__en__kioslave__file__index.docbook
                     ^
runtime error
Evaluating user parameter outputFile failed
-------------------
This is an old issue, it was "solved" on windows by not compiling that code, but I suspect that the issue has been in UNIX systems too for a long time.

Another way to solve the bug is quoting the value of the parameter with '...', replacing:
params.append(qstrdup(parser.value(QStringLiteral("output")).toLocal8Bit().constData()));

with something like
QString quotedOutput = "'" + parser.value(QStringLiteral("output")) + "'";
params.append(qstrdup(quotedOutput.toLocal8Bit().constData()));

but anyway in this case the name of output file is not used, or I can't find any occurrence in the stylesheets. 
The stylesheet is applied and the name of the file is used only after to write the generated XML (see tranform() function).

A similar patch can be applied to kdelibs/kdoctools too (same codepath).</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Run meinproc5 (and 4) with -o /something/with/a/.dotdir/myfile.txt (the directory must exist), no error anymore and the file is generated.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/meinproc.cpp <span style="color: grey">(95adcea)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/116604/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>