From 5ae2031bcfd010fb91fed50c56d8d92e7a5bde70 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 11 Oct 2022 14:28:21 +0200 Subject: [PATCH 1/3] Manually cherry pick shell process name detection --- src/detection/terminalShell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/terminalShell.c b/src/detection/terminalShell.c index cd3785a0f..820a99106 100644 --- a/src/detection/terminalShell.c +++ b/src/detection/terminalShell.c @@ -95,7 +95,7 @@ static void getTerminalShell(FFTerminalShellResult* result, const char* pid) strcasecmp(name, "dash") == 0 || strcasecmp(name, "git-shell") == 0 ) { - ffStrbufAppendS(&result->shellProcessName, name); + ffStrbufSetS(&result->shellProcessName, name); // prevent from `fishbash` getProcessInformation(pid, &result->shellProcessName, &result->shellExe, &result->shellExeName); getTerminalShell(result, ppid); From 4393fa1a4758449f95b2943ae4d30b20da0310f9 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 11 Oct 2022 12:37:54 +0200 Subject: [PATCH 2/3] ffStrbufLastIndexC: account for empty strings #285 --- src/detection/terminalShell.c | 1 - src/util/FFstrbuf.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalShell.c b/src/detection/terminalShell.c index 820a99106..9ab5ba1eb 100644 --- a/src/detection/terminalShell.c +++ b/src/detection/terminalShell.c @@ -210,7 +210,6 @@ static void getShellVersionZsh(FFstrbuf* exe, FFstrbuf* version) "--version", NULL }); - ffStrbufTrimRight(version, '\n'); ffStrbufSubstrBeforeLastC(version, ' '); ffStrbufSubstrAfterFirstC(version, ' '); } diff --git a/src/util/FFstrbuf.h b/src/util/FFstrbuf.h index d6397c6dc..687969606 100644 --- a/src/util/FFstrbuf.h +++ b/src/util/FFstrbuf.h @@ -184,6 +184,9 @@ static inline FF_C_NODISCARD uint32_t ffStrbufFirstIndexS(const FFstrbuf* strbuf static inline FF_C_NODISCARD uint32_t ffStrbufLastIndexC(const FFstrbuf* strbuf, char c) { + if(strbuf->length == 0) + return strbuf->length; + return ffStrbufPreviousIndexC(strbuf, strbuf->length - 1, c); } From 875174e2e01bb0bff45da2dc0588ee9391e02906 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 11 Oct 2022 14:26:00 +0200 Subject: [PATCH 3/3] Release 1.7.5 --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffb90a097..c91d6efa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.7.5 + +Fixes a crash on linux that could happen when getting zsh version (#285) + # 1.7.4 The last element in the default structure (currently the color blocks) is now printed again (#283) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29614b1fb..59f624765 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 1.7.4 + VERSION 1.7.5 LANGUAGES C DESCRIPTION "Fast system information tool" HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"