Skip to content

Commit 6a31736

Browse files
committed
Shell: fix fish version detection when LC_ALL is set
Fixes #2014
1 parent dc3e4a2 commit 6a31736

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/detection/terminalshell/terminalshell.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "util/binary.h"
77

88
#include <ctype.h>
9+
#include <stdint.h>
910
#ifdef __FreeBSD__
1011
#include <paths.h>
1112
#ifndef _PATH_LOCALBASE
@@ -85,8 +86,10 @@ static bool getShellVersionFish(FFstrbuf* exe, FFstrbuf* version)
8586
if(!getExeVersionRaw(exe, version))
8687
return false;
8788

88-
//fish, version 4.0.2-1 (Built by MSYS2 project)
89-
ffStrbufSubstrAfterFirstS(version, "version ");
89+
//fish, version 4.0.2-1 (Built by MSYS2 project) // version can be localized if LC_ALL is set
90+
if (version->length < strlen("fish, v")) return false;
91+
uint32_t index = ffStrbufNextIndexC(version, strlen("fish, "), ' ');
92+
ffStrbufSubstrAfter(version, index);
9093
ffStrbufSubstrBeforeFirstC(version, ' ');
9194
return true;
9295
}

0 commit comments

Comments
 (0)