commit e2c96f5c96ed9c8581582c90237b4c44c9a991f6
Author: Pavel Sanda <[email protected]>
Date: Wed Sep 16 23:40:17 2026 +0200
Auth gate: probe by command that will actually run
Stripped directory could make the match between probe and triggered
processor ambiguous
if two binaries of the same name live on the system by chance.
Document can not trigger this: a command must match index_alternatives
as a whole token, so it never carries a path.
Tier 01 DiD / 00de: gate to probe command, not just name
https://www.mail-archive.com/[email protected]/msg226943.html
Assisted-by: Claude Opus 5
---
src/LaTeX.cpp | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 25c9afb618..09a2019fc3 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -879,10 +879,12 @@ bool isProcessorGated(string const & command)
{
string prog;
split(command, prog, ' '); // first whitespace token only
- prog = onlyFileName(prog); // strip any directory part
- if (prog.empty())
+ string const name = onlyFileName(prog); // table key
+ if (name.empty())
return true;
+ // Cache per configured command, not per program name:
+ // two binaries of the same name can live at different paths.
static map<string, bool> cache;
map<string, bool>::const_iterator const it = cache.find(prog);
if (it != cache.end())
@@ -890,7 +892,7 @@ bool isProcessorGated(string const & command)
bool gated = true; // fail-safe default
for (RequiredProcessor const & p : required_processors) {
- if (prog != p.prog)
+ if (name != p.prog)
continue;
if (p.safe) { // non-interpreter: never gate, no
probe
gated = false;
@@ -908,9 +910,14 @@ bool isProcessorGated(string const & command)
FileName const probe_dir = createLyXTmpDir(FileName());
if (!probe_dir.empty()) {
FileName const saved = FileName::getcwd();
+ // Keep bare name if used (runs via PATH),
+ // make absolute if directory was used - chdir is below
+ string const probe_prog = (prog == name) ? prog
+ : makeAbsPath(prog,
saved.absFileName()).absFileName();
probe_dir.chdir();
Systemcall one;
- probe_ret = one.startscriptArgv(prog, { p.version_arg },
+ probe_ret = one.startscriptArgv(probe_prog,
+ { p.version_arg },
&probe_out);
saved.chdir();
probe_dir.destroyDirectory();
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs