[LyX/master] Cmake export tests: Enable unsafe dvipdfmx

Kornel Benko kornel at lyx.org
Sun May 23 08:03:57 UTC 2021


commit 5158b54eb955e0ce0d1a879e0a0985eb2b5ca2f5
Author: Kornel Benko <kornel at lyx.org>
Date:   Sun May 23 10:05:13 2021 +0200

    Cmake export tests: Enable unsafe dvipdfmx
    
    Add parameter "-i dvipdfmx-unsafe.cfg" for call to dvipdfmx.
    Used only in test environment.
    This is needed because of regression for ja LilyPond found by Scott.
    Coment by Jürgen:
      "dvipdfmx-unsafe.cfg makes dvipdfmx call gs (rungs) with -dNOSAFER
      rather than with -DSAFER (as in the default dvipdfmx.cfg of TL21).
    
      However, this change should definitely only be applied to trustworthy
      files, so changing the converter generally is certainly not such a good
      idea."
---
 lib/scripts/prefTest.pm |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/scripts/prefTest.pm b/lib/scripts/prefTest.pm
index 1f1470f..e98ac4a 100644
--- a/lib/scripts/prefTest.pm
+++ b/lib/scripts/prefTest.pm
@@ -87,23 +87,32 @@ sub getConverter($$)
   chomp($l);
   my ($from, $to, $cmd, $par);
   ($l, $from) = getNext($l);
-  return undef if ($from !~ /tex$/);
+  return undef if ($from !~ /(tex|dvi)$/);
   ($l, $to) = getNext($l);
   return undef if ($to !~ /^((dvi3?|pdf[23456]?)(log)?)$/);
+  my ($checkfor, $substitute);
+  if ($from =~ /tex/) {
+    $checkfor = qr/\s+\-shell\-(escape|restricted)/;
+    $substitute = "-shell-escape";
+  }
+  else {
+    $checkfor = qr/\s+-i\s+dvipdfmx-unsafe.cfg/;
+    $substitute = "-i dvipdfmx-unsafe.cfg";
+  }
   ($l, $cmd) = getNext($l);
   if ($add) {
-    if ($cmd !~ /\-shell-(escape|restricted)/) {
+    if ($cmd !~ $checkfor) {
       if ($cmd =~ /^(\S+)\s*(.*)$/) {
-	$cmd = "$1 -shell-escape $2";
+	$cmd = "$1 $substitute $2";
 	$cmd =~ s/\s+$//;
       }
     }
   }
   else {
-    $cmd =~ s/\s+\-shell\-(escape|restricted)//;
+    $cmd =~ s/$checkfor//;
   }
   ($l, $par) = getNext($l);
-  return undef if ($par !~ /^latex/);
+  return undef if ($par !~ /^(latex|hyperref-driver=dvipdfm)/);
   my $key = "\"$from\" \"$to\"";
   if ($add) {
     return([$key, [$cmd, $par]]);


More information about the lyx-cvs mailing list