On Wed, Sep 20, 2023 at 09:19:31PM -0400, Scott Kostyshak wrote:

For the ctests, we put the following into preferences:

 \converter "pdflatex" "pdf2" "pdflatex -shell-escape $$i" 

If I export on the GUI, I get a reasonable warning. But if I export on
the command-line something goes wrong with Qt6, but not Qt5 for some
reason. Presumably the issue is that LyX tries to give the warning but
there's no GUI since it's a command-line export.

Attached is the backtrace.

Can anyone reproduce with Qt6? To reproduce, put the above \coverter
command in the user directory preferences file, then do a command line
export (e.g., "-e pdf2 <file.lyx>").

This might be a Qt6 bug. The attached patch works for me.

diff --git a/src/Converter.cpp b/src/Converter.cpp
index b63f77146a..5c3f0f2dd4 100644
--- a/src/Converter.cpp
+++ b/src/Converter.cpp
@@ -311,16 +311,18 @@ bool Converters::checkAuth(Converter const & conv, string 
const & doc_fname,
        bool const has_shell_escape = contains(conv_command, "-shell-escape")
                                || contains(conv_command, "-enable-write18");
        if (conv.latex() && has_shell_escape && !use_shell_escape) {
+               string const cmd = use_gui ? "<tt>" + conv_command + "</tt"
+                                          : conv_command;
                docstring const shellescape_warning =
                      bformat(_("<p>The following LaTeX backend has been "
                        "configured to allow execution of external programs "
                        "for any document:</p>"
-                       "<center><p><tt>%1$s</tt></p></center>"
+                       "<center><p>%1$s</p></center>"
                        "<p>This is a dangerous configuration. Please, "
                        "consider using the support offered by LyX for "
                        "allowing this privilege only to documents that "
                        "actually need it, instead.</p>"),
-                       from_utf8(conv_command));
+                       from_utf8(cmd));
                frontend::Alert::error(_("Security Warning"),
                                        shellescape_warning , false);
        } else if (!conv.latex())
lyx-devel mailing list

Reply via email to