On Tue, Sep 01, 2026 at 08:35:31PM +0200, Pavel Sanda wrote: > On Mon, Aug 31, 2026 at 09:54:20PM +0200, Pavel Sanda wrote: > > The first batch of patches tries to sanitize runCommand() calls. > > The next one uses new startscriptArgv to close kpsewhich hole > in a less fragile way.
Ok, with 03 class finished (invocation on load) I'll continue with misc lefotvers (04 class). First - guard better esoteric biblio paperviewer from context menu. Pavel
>From d6691d357e3aefc6ca9c5420ad3d799ffb062ac6 Mon Sep 17 00:00:00 2001 From: Pavel Sanda <[email protected]> Date: Sun, 13 Sep 2026 17:08:32 +0200 Subject: [PATCH 10/14] Route the citation-search script through argv form DiD - by default citation search false & does not autotrigger. Original runCommand() read its pipe in text mode, so on Windows CRLF used to be LF. QProcess returns raw, so we need to handle CRLF manually. Tier 01 DiD / argv 04a: argv-form citation search Assisted-by: Claude Opus 5 --- src/frontends/qt/qt_helpers.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp index ae9db8ac41..53cadec6e0 100644 --- a/src/frontends/qt/qt_helpers.cpp +++ b/src/frontends/qt/qt_helpers.cpp @@ -317,16 +317,29 @@ void showTarget(string const & target_in, Buffer const & buf) string tmp, tar; tar = split(target, tmp, ' '); string const scriptcmd = subst(lyxrc.citation_search_view, "$${python}", os::python()); - string const command = scriptcmd + " " + tar; - cmd_ret const ret = runCommand(commandPrep(command)); - if (!ret.valid) { + // tar string is controlled by user's biblio & script comes from user prefs. + vector<string> argv = splitCommandTokens(commandPrep(scriptcmd)); + if (argv.empty()) { + frontend::Alert::error(_("Could not open file"), + _("The lyxpaperview script failed.")); + return; + } + string const program = argv.front(); + argv.erase(argv.begin()); + argv.push_back(tar); + + Systemcall one; + string out; + if (one.startscriptArgv(program, argv, &out) != Systemcall::OK) { // Script failed frontend::Alert::error(_("Could not open file"), _("The lyxpaperview script failed.")); return; } - // lyxpaperview returns a \n-separated list of paths - targets = getVectorFromString(rtrim(ret.result, "\n"), "\n"); + // lyxpaperview returns a \n-separated list of paths. QProcess + // returns untranslated bytes, handle CRLF on Windows as well. + out = subst(out, "\r\n", "\n"); + targets = getVectorFromString(rtrim(out, "\n"), "\n"); if (targets.empty()) { frontend::Alert::error(_("Could not open file"), bformat(_("No file was found using the pattern `%1$s'."), -- 2.39.5
-- lyx-devel mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-devel
