chessbaseLinux/packaging/rodent-iv/home-dir.patch
vrubelroman 3fe82551ce
Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 41s
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
Play: Rodent IV's characters and players in Rodent's list of styles
The owner: «заюзаем rodent 4 со всеми его стилями». One opponent «Rodent»:
its list gets Rodent IV's 13 characters and 22 players (sorted by their names
as shown, the Tals side by side); the engine follows the style (Rodent IV's
UCI_Elo 800–2800), «Rodent IV 2000 (Petrosian)» in the record. Texts say
«Rodent» where they said «Rodent V».

Rodent IV's authors publish no builds for Linux and Windows: the workflow
rodent-iv.yml builds it from their sources at a pinned commit (with one fix,
packaging/rodent-iv/home-dir.patch: on Linux it now and then took a wrong home
folder and played without its personality) into a pre-release that is never
«latest». The app downloads that build and the personalities and books from
the authors' repository at the same commit (scripts/rodent4-manifest.py →
rodent4_files.rs), each checked; three misnamed books get a copy under the
name their personality reads. Until the build's sums are written in, Rodent
IV's styles are not shown.

Reviewed (tester and designer in one) with a local build (CP_RODENT4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 20:53:49 +03:00

16 lines
751 B
Diff

diff --git a/sources/src/rodenthome.cpp b/sources/src/rodenthome.cpp
index 058cdaa..e8018b7 100755
--- a/sources/src/rodenthome.cpp
+++ b/sources/src/rodenthome.cpp
@@ -199,7 +199,10 @@ void SetRodentHomeDir() {
} else {
char exe_path[1024];
// getting the current executable location ...
- readlink("/proc/self/exe", exe_path, sizeof(exe_path));
+ // The link's target is not null-terminated: terminate it, or stray bytes
+ // after it make a wrong home directory now and then.
+ ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
+ exe_path[len > 0 ? len : 0] = '\0';
*(strrchr(exe_path, '/') + 1) = '\0';
RodentHomeDirWStr = CStr2WStr(exe_path);