MDL-71240 filter_tex: Support paranoid mode for openin_any in latex

This commit is contained in:
Shamim Rezaie
2021-09-07 00:14:39 +02:00
committed by Jenkins
parent 0cd2cbccfb
commit cd7fa2e513
2 changed files with 9 additions and 6 deletions
+4 -4
View File
@@ -238,12 +238,15 @@
$output .= "<p>base filename for expression is '$md5'</p>\n";
// temporary paths
$tex = "$latex->temp_dir/$md5.tex";
$tex = "$md5.tex"; // Absolute paths won't work with openin_any = p setting.
$dvi = "$latex->temp_dir/$md5.dvi";
$ps = "$latex->temp_dir/$md5.ps";
$convertformat = get_config('filter_tex', 'convertformat');
$img = "$latex->temp_dir/$md5.{$convertformat}";
// Change directory to temp dir so that we can work with relative paths.
chdir($latex->temp_dir);
// put the expression as a file into the temp area
$expression = html_entity_decode($expression);
$output .= "<p>Processing TeX expression:</p><pre>$expression</pre>\n";
@@ -252,9 +255,6 @@
fputs($fh, $doc);
fclose($fh);
// cd to temp dir
chdir($latex->temp_dir);
// step 1: latex command
$pathlatex = escapeshellarg($pathlatex);
$cmd = "$pathlatex --interaction=nonstopmode --halt-on-error $tex";