On Mon, Sep 28, 2026 at 10:14:16PM +0200, Pavel Sanda wrote:
> I'll keep posting next pacthes for various issues, but should not
> be that big in scope as was this stack - the largest shell-invocation
> surface is now gone.

Fix corner case of conset gate found when manipulating with different
biber versions on the same machine.

Pavel
>From b7205c524cedee3c8243866c241a52d082691b47 Mon Sep 17 00:00:00 2001
From: Pavel Sanda <[email protected]>
Date: Wed, 16 Sep 2026 23:40:17 +0200
Subject: [PATCH] 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

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 954169e098..66194ddef3 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;
@@ -911,9 +913,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();
-- 
2.39.5

-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to