--- Comment #11 from Ralf Lederle <> 
2010-03-09 11:18:25 UTC ---
I tried it, but it still doesn't work.

As far as I can see, you changed wfEscapeShellArg to escape the caret
character. However in my opinion the problem is not the wfEscapeShellArg
function but the escapeshellarg function, which is used to quote the texcv

The escapeshellarg does _not_ use single quotes regardless of OS (so the
comment before the wfEscapeShellArg definition in GlobalFunctions.php is
wrong), but under Windows it uses double quotes. This is also mentioned in a
comment in the PHP online manual.

I tried to write a new escapeshellarg function, which always uses single

function wfEscapeSingleQuotes( $str ) {
  return "'" . str_replace( "'", "'\\''", $str ) . "'";

and used it in Math.php:

$cmd = $wgTexvc . ' ' .
    wfEscapeSingleQuotes( $wgTmpDirectory ).' '.
    wfEscapeSingleQuotes( $wgTmpDirectory ).' '.
    wfEscapeSingleQuotes( $this->tex ).' '.
    wfEscapeSingleQuotes( $wgInputEncoding ).' '.
    wfEscapeSingleQuotes(   $wgTexvcBackgroundColor );

if ( wfIsWindows() ) {
    $cmd = 'sh -c ' . wfEscapeShellArg( $cmd );

This works (under Windows - I did not try Linux) except for the caret
character. When I coment out your change in wfEscapeShellArg the caret works

By the way: I noticed, that wfEscapeShellArg escapes double quotes with
backslashes. I don't know if this is working too, but I read that in the
Windows shell double quotes usually are escaped with a second double quote
( - chapter "Simple
Command Syntax").

Quite confusing, this escaping stuff! (Especially if you have to mix Windows
and Unix shells.)

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

Wikibugs-l mailing list

Reply via email to