Skip to content

Commit 912f6c4

Browse files
authored
Merge pull request #752 from fastfetch-cli/dev
Release: v2.8.8
2 parents 6a82d73 + 77d71b5 commit 912f6c4

File tree

78 files changed

+493
-470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+493
-470
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# 2.8.8
2+
3+
Bugfixes:
4+
* Fix old fish version compatibility (#744)
5+
* Fix truncated texts in `--help format` (#745)
6+
* Fix old vulkan-header and libdrm library compatibility (#748, Linux)
7+
* Fix possible segfaults in `--help *-format` (#749)
8+
* Fix invalid resolution detection when using libdrm (Linux, Display)
9+
* Fix segfault when `/sys/devices/system/cpu/cpufreq/` doesn't exist (#750, CPU, Linux)
10+
* Don't detect `SessionLeader` as terminal (Terminal, Linux)
11+
* Fix detection of client IP (Users, Linux)
12+
113
# 2.8.7
214

315
Bugfixes:

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 2.8.7
4+
VERSION 2.8.8
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -233,10 +233,9 @@ endif()
233233

234234
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
235235
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
236-
fastfetch_load_text(src/data/help.txt DATATEXT_HELP)
236+
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
237237
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
238238
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
239-
fastfetch_load_text(src/data/help_config.txt DATATEXT_HELP_CONFIG)
240239

241240
configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)
242241
configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
2727

2828
### Linux
2929

30-
* Ubuntu: `ppa:zhangsongcui3371/fastfetch`
31-
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb`
30+
Some distros packaged a outdated fastfetch version. Older version is not supported, please always ensure that the latest version is used.
31+
32+
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or above)
33+
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb` (for Ubuntu 22.04 or above and Debian 12 or above).
3234
* Arch Linux: `sudo pacman -S fastfetch`. You can also find fastfetch [on the AUR](https://aur.archlinux.org/packages/fastfetch-git).
3335
* Fedora: `sudo dnf install fastfetch`
3436
* Gentoo: `sudo emerge --ask app-misc/fastfetch`

completions/fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env fish
22

33
if not type -q fastfetch
4-
return
4+
exit
55
end
66

77
complete -c fastfetch -f

src/common/commandoption.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void ffPrepareCommandOption(FFdata* data)
2626
FFOptionsModules* const options = &instance.config.modules;
2727
//If we don't have a custom structure, use the default one
2828
if(data->structure.length == 0)
29-
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
29+
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
3030

3131
if(ffStrbufContainIgnCaseS(&data->structure, FF_CPUUSAGE_MODULE_NAME))
3232
ffPrepareCPUUsage();
@@ -118,7 +118,7 @@ static void parseStructureCommand(
118118
}
119119
}
120120

121-
ffPrintErrorString(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
121+
ffPrintError(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
122122
}
123123

124124
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
@@ -168,7 +168,7 @@ void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc)
168168
{
169169
//If we don't have a custom structure, use the default one
170170
if(data->structure.length == 0)
171-
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
171+
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
172172

173173
//Parse the structure and call the modules
174174
uint32_t startIndex = 0;

src/common/format.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ typedef struct FFformatarg
2424

2525
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
2626
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
27+
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, numArgs, arguments) do {\
28+
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
29+
ffParseFormatString((buffer), (formatstr), (numArgs), (arguments));\
30+
} while (0)

src/common/jsonconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,6 @@ void ffPrintJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
235235
yyjson_mut_doc_set_root(jsonDoc, obj);
236236
}
237237
else
238-
ffPrintErrorString("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
238+
ffPrintError("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
239239
}
240240
}

src/common/printing.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
3737
else
3838
{
3939
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
40-
ffParseFormatString(&key, &moduleArgs->key, 1, (FFformatarg[]){
40+
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 1, ((FFformatarg[]){
4141
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex}
42-
});
42+
}));
4343
ffStrbufWriteTo(&key, stdout);
4444
}
4545

@@ -60,7 +60,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
6060
}
6161
}
6262

63-
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
63+
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
6464
{
6565
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
6666
if (moduleArgs)
@@ -93,22 +93,14 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
9393
putchar('\n');
9494
}
9595

96-
void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
96+
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
9797
{
9898
va_list arguments;
9999
va_start(arguments, message);
100100
printError(moduleName, moduleIndex, moduleArgs, printType, message, arguments);
101101
va_end(arguments);
102102
}
103103

104-
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...)
105-
{
106-
va_list arguments;
107-
va_start(arguments, message);
108-
printError(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, message, arguments);
109-
va_end(arguments);
110-
}
111-
112104
void ffPrintColor(const FFstrbuf* colorValue)
113105
{
114106
//If the color is not set, this would reset in \033[m, which resets everything.

src/common/printing.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ typedef enum FFPrintType {
1212
} FFPrintType;
1313

1414
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
15-
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
16-
static inline void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, uint32_t numArgs, const FFformatarg* arguments)
17-
{
18-
ffPrintFormatString(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, numArgs, arguments);
19-
}
20-
FF_C_PRINTF(5, 6) void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
21-
FF_C_PRINTF(4, 5) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...);
15+
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
16+
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
17+
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
18+
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
19+
} while (0)
20+
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
2221
void ffPrintColor(const FFstrbuf* colorValue);
2322
void ffPrintCharTimes(char c, uint32_t times);
2423

2524
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
25+
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
26+
static_assert(sizeof(args) / sizeof(*(args)) == (numArgs), "Invalid number of format arguments");\
27+
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
28+
} while (0)

src/data/help_config.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)