From 6c88981b05c9731f998adeaaa8350bb54557c3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 28 Feb 2024 09:17:29 +0800 Subject: [PATCH 01/11] JsonSchema: disallow additional properties --- doc/json_schema.json | 181 +++++++++++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 66 deletions(-) diff --git a/doc/json_schema.json b/doc/json_schema.json index 73c8adce1..bc436f26c 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -30,6 +30,7 @@ "percent": { "description": "Threshold of percentage colors", "type": "object", + "additionalProperties": false, "properties": { "green": { "type": "integer", @@ -54,6 +55,7 @@ }, { "type": "object", + "additionalProperties": false, "properties": { "green": { "type": "integer", @@ -73,6 +75,7 @@ } }, "type": "object", + "additionalProperties": false, "title": "JSON config", "description": "JSON config file for fastfetch. Usually be `~/.config/fastfetch.jsonc`", "properties": { @@ -95,6 +98,7 @@ { "description": "Fastfetch logo configurations", "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Set the type of the logo given", @@ -122,6 +126,7 @@ }, "color": { "type": "object", + "additionalProperties": false, "description": "Overwrite a color in the logo", "properties": { "1": { @@ -160,8 +165,7 @@ "description": "Color 9", "$ref": "#/$defs/colors" } - }, - "additionalProperties": false + } }, "width": { "type": "integer", @@ -175,6 +179,7 @@ }, "padding": { "type": "object", + "additionalProperties": false, "description": "Set the padding of the logo", "properties": { "top": { @@ -192,8 +197,7 @@ "description": "Set the right padding of the logo", "minimum": 0 } - }, - "additionalProperties": false + } }, "printRemaining": { "type": "boolean", @@ -217,6 +221,7 @@ }, "chafa": { "type": "object", + "additionalProperties": false, "description": "Chafa configuration. See chafa document for details", "properties": { "fgOnly": { @@ -259,17 +264,16 @@ "DIFFUSION" ] } - }, - "additionalProperties": false + } } - }, - "additionalProperties": false + } } ] }, "general": { "description": "Fastfetch general configurations", "type": "object", + "additionalProperties": false, "properties": { "multithreading": { "type": "boolean", @@ -325,12 +329,12 @@ "description": "Set the timeout (ms) when waiting for child processes, `-1` for no timeout", "default": 1000 } - }, - "additionalProperties": false + } }, "display": { "description": "Configure how things to be displayed", "type": "object", + "additionalProperties": false, "properties": { "stat": { "type": "boolean", @@ -371,6 +375,7 @@ }, { "type": "object", + "additionalProperties": false, "properties": { "keys": { "description": "Set the color of the keys", @@ -380,8 +385,7 @@ "description": "Set the color of the title", "$ref": "#/$defs/colors" } - }, - "additionalProperties": false + } } ] }, @@ -416,6 +420,7 @@ }, "size": { "type": "object", + "additionalProperties": false, "description": "Set how a size value should be displayed", "properties": { "maxPrefix": { @@ -435,6 +440,7 @@ }, "temp": { "type": "object", + "additionalProperties": false, "description": "Set how temperature values should be displayed", "properties": { "unit": { @@ -452,6 +458,7 @@ }, "color": { "type": "object", + "additionalProperties": false, "description": "Set color used in different states of temperature values", "properties": { "green": { @@ -472,6 +479,7 @@ }, "bar": { "type": "object", + "additionalProperties": false, "description": "Set the bar configuration", "properties": { "charElapsed": { @@ -499,6 +507,7 @@ }, "percent": { "type": "object", + "additionalProperties": false, "description": "Set how a percentage value should be displayed", "properties": { "type": { @@ -517,6 +526,7 @@ }, "color": { "type": "object", + "additionalProperties": false, "description": "Set color used in different states of percentage bars and numbers", "properties": { "green": { @@ -540,12 +550,12 @@ "description": "Whether to disable the stdout application buffer", "default": false } - }, - "additionalProperties": false + } }, "library": { "description": "Set the path of a library to load", "type": "object", + "additionalProperties": false, "properties": { "pci": { "type": "string", @@ -647,8 +657,7 @@ "description": "Used for brightness detection of external displays (Linux)", "type": "string" } - }, - "additionalProperties": false + } }, "modules": { "description": "Fastfetch modules to run", @@ -721,6 +730,7 @@ }, { "type": "object", + "additionalProperties": false, "description": "Run module with custom configurations", "required": [ "type" @@ -733,16 +743,20 @@ "oneOf": [ { "title": "Break", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "break", "description": "Print a empty line" } - }, - "additionalProperties": false + } }, { + "title": "module", "description": "No additional properties", + "type": "object", + "additionalProperties": false, "properties": { "type": { "anyOf": [ @@ -880,11 +894,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Battery", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "battery", @@ -913,11 +928,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Bluetooth", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "List bluetooth devices", @@ -943,11 +959,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Brightness", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "brightness", @@ -967,6 +984,8 @@ }, { "title": "Chassis", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "chassis", @@ -988,6 +1007,8 @@ }, { "title": "CPU", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print CPU name, frequency, etc", @@ -1015,11 +1036,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "CPU Usage", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "cpuusage", @@ -1037,6 +1059,8 @@ }, { "title": "Colors", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print some colored blocks", @@ -1064,6 +1088,7 @@ "block": { "description": "Set behavior of block printing", "type": "object", + "additionalProperties": false, "properties": { "width": { "description": "Set the block width in spaces", @@ -1088,6 +1113,8 @@ }, { "title": "Command", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Running custom shell scripts", @@ -1113,11 +1140,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Custom", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print a custom string, with or without key", @@ -1140,11 +1168,12 @@ }, "required": [ "format" - ], - "additionalProperties": false + ] }, { "title": "Display", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print resolutions, refresh rates, etc", @@ -1187,11 +1216,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Disk", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print partitions, space usage, disk type, etc", @@ -1246,11 +1276,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "DiskIO", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print physical disk I/O throughput", @@ -1277,11 +1308,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "DE", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "de", @@ -1308,6 +1340,8 @@ }, { "title": "Gamepad", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "gamepad", @@ -1328,11 +1362,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "GPU", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print GPU names, graphic memory size, type, etc", @@ -1372,11 +1407,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Local IP", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "List local IP addresses (v4 or v6), MAC addresses, etc", @@ -1428,11 +1464,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Memory", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "memory", @@ -1453,11 +1490,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "NetIO", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print network I/O throughput", @@ -1489,11 +1527,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "OpenGL", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print highest OpenGL version supported by the GPU", @@ -1521,11 +1560,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Packages", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "packages", @@ -1552,6 +1592,8 @@ }, { "title": "Physical Disk", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print physical disk information", @@ -1576,11 +1618,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Public IP", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print your public IP address, etc", @@ -1610,11 +1653,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Separator", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print a separator line", @@ -1625,11 +1669,12 @@ "type": "string", "default": "-" } - }, - "additionalProperties": false + } }, { "title": "Sound", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print sound devices, volume, etc", @@ -1660,11 +1705,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Swap", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "swap", @@ -1685,11 +1731,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Title", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print title, which contains your user name, hostname", @@ -1702,6 +1749,8 @@ }, "color": { "description": "Set colors of the different part of title", + "type": "object", + "additionalProperties": false, "properties": { "user": { "description": "Set color of the user name (left part)", @@ -1715,8 +1764,7 @@ "description": "Set color of the host name (right part)", "$ref": "#/$defs/colors" } - }, - "additionalProperties": false + } }, "key": { "$ref": "#/$defs/key" @@ -1730,11 +1778,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "Weather", + "type": "object", + "additionalProperties": false, "properties": { "type": { "description": "Print weather information", @@ -1767,11 +1816,12 @@ "format": { "$ref": "#/$defs/format" } - }, - "additionalProperties": false + } }, { "title": "WM", + "type": "object", + "additionalProperties": false, "properties": { "type": { "const": "wm", @@ -1801,6 +1851,5 @@ ] } } - }, - "additionalProperties": false + } } From f238138711becf1e37c2c9c522130a5e9e903948 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 28 Feb 2024 10:03:26 +0800 Subject: [PATCH 02/11] Packaging: update debian stuff --- debian/changelog | 6 ++++++ debian/files | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 42c04c1dd..dbdcc4b4a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fastfetch (2.8.6) jammy; urgency=medium + + * Update to 2.8.6 + + -- Carter Li Wed, 28 Feb 2024 10:01:40 +0800 + fastfetch (2.8.4) jammy; urgency=medium * Update to 2.8.4 diff --git a/debian/files b/debian/files index 457ecbfa7..df3bbef93 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -fastfetch_2.8.4_source.buildinfo universe/utils optional +fastfetch_2.8.6_source.buildinfo universe/utils optional From 979f7d19b137b8087954119103a4ff72f1f55cb6 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 29 Feb 2024 10:20:50 +0800 Subject: [PATCH 03/11] CPU (Linux): fix max / min frequency detection for multi policy systems --- src/detection/cpu/cpu_linux.c | 76 ++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/src/detection/cpu/cpu_linux.c b/src/detection/cpu/cpu_linux.c index 4446f0458..d21401f9f 100644 --- a/src/detection/cpu/cpu_linux.c +++ b/src/detection/cpu/cpu_linux.c @@ -85,30 +85,58 @@ static const char* parseCpuInfo(FFCPUResult* cpu, FFstrbuf* physicalCoresBuffer, return NULL; } -static double getGHz(const char* file) +static double getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, const char* scalingFileName, FFstrbuf* buffer) { - FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate(); - if(ffAppendFileBuffer(file, &content)) - { - double herz = ffStrbufToDouble(&content); - - //ffStrbufToDouble failed - if(herz != herz) - return 0; - - herz /= 1000.0; //to MHz - return herz / 1000.0; //to GHz - } - return 0; + uint32_t baseLen = basePath->length; + ffStrbufAppendS(basePath, cpuinfoFileName); + bool ok = ffReadFileBuffer(basePath->chars, buffer); + ffStrbufSubstrBefore(basePath, baseLen); + if (ok) + return ffStrbufToDouble(buffer) / 1e6; + + ffStrbufAppendS(basePath, scalingFileName); + ok = ffReadFileBuffer(basePath->chars, buffer); + ffStrbufSubstrBefore(basePath, baseLen); + if (ok) + return ffStrbufToDouble(buffer) / 1e6; + + return 0.0/0.0; } -static double getFrequency(const char* info, const char* scaling) +static bool detectFrequency(FFCPUResult* cpu) { - double frequency = getGHz(info); - if(frequency > 0.0) - return frequency; + FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/"); + FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars); + FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); + uint32_t baseLen = path.length; + bool flag = false; + + struct dirent* entry; + while((entry = readdir(dir)) != NULL) + { + if (ffStrStartsWith(entry->d_name, "policy") && isdigit(entry->d_name[strlen("policy")])) + { + ffStrbufAppendS(&path, entry->d_name); + double fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer); + if (fmin != fmin) continue; + double fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer); + if (fmax != fmax) continue; - return getGHz(scaling); + if (flag) + { + cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin; + cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax; + } + else + { + cpu->frequencyMin = fmin; + cpu->frequencyMax = fmax; + flag = true; + } + ffStrbufSubstrBefore(&path, baseLen); + } + } + return flag; } static double detectCPUTemp(void) @@ -204,16 +232,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) cpu->coresOnline = (uint16_t) get_nprocs(); cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical); - #define BP "/sys/devices/system/cpu/cpufreq/policy0/" - if(ffPathExists(BP, FF_PATHTYPE_DIRECTORY)) - { - cpu->frequencyMin = getFrequency(BP"cpuinfo_min_freq", BP"scaling_min_freq"); - cpu->frequencyMax = getFrequency(BP"cpuinfo_max_freq", BP"scaling_max_freq"); - } - else - { + if (!detectFrequency(cpu)) cpu->frequencyMin = cpu->frequencyMax = ffStrbufToDouble(&cpuMHz) / 1000; - } if(cpuUarch.length > 0) { From 66aee54401e19cbaa5f07ed09b02b3e404d642a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 1 Mar 2024 10:27:25 +0800 Subject: [PATCH 04/11] CMake: add more debug flags --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a36240276..3dbd6c1bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ if(ENABLE_ASAN) set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address") endif() set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}") -set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}") +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG} -fstack-protector-all -fno-delete-null-pointer-checks") if(NOT WIN32) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic") endif() From c3970154d6e1a6708c79dc0e43fd2d163a5ecde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 1 Mar 2024 10:41:42 +0800 Subject: [PATCH 05/11] GPU (Linux): fix memleaks --- src/detection/gpu/gpu_linux.c | 2 +- src/modules/physicaldisk/physicaldisk.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index d1fb13e4f..3cc6bdcdd 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -78,7 +78,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus) //https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci const char* pciDirPath = "/sys/bus/pci/devices/"; - DIR* dirp = opendir(pciDirPath); + FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDirPath); if(dirp == NULL) return "Failed to open `/sys/bus/pci/devices/`"; diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 7bb9187cb..96d0c2c12 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -130,6 +130,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) ffStrbufDestroy(&dev->interconnect); ffStrbufDestroy(&dev->devPath); ffStrbufDestroy(&dev->serial); + ffStrbufDestroy(&dev->revision); } } @@ -244,6 +245,8 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut ffStrbufDestroy(&dev->name); ffStrbufDestroy(&dev->interconnect); ffStrbufDestroy(&dev->devPath); + ffStrbufDestroy(&dev->serial); + ffStrbufDestroy(&dev->revision); } } From 14d3bd89a7643d6160ba349b16e8c16d41e3b593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 1 Mar 2024 22:07:54 +0800 Subject: [PATCH 06/11] Brightness (Linux): fix ddcutil 2.1 compatibility --- src/detection/brightness/brightness_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/brightness/brightness_linux.c b/src/detection/brightness/brightness_linux.c index 266e72702..c1885260d 100644 --- a/src/detection/brightness/brightness_linux.c +++ b/src/detection/brightness/brightness_linux.c @@ -114,7 +114,7 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result) { FF_SUPPRESS_IO(); // Ref: https://github.com/rockowitz/ddcutil/issues/344 - if (ffddca_init("--disable-watch-displays", -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) + if (ffddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0) return "ddca_init() failed"; } else From fc685e9aa0fcd2b7afdda1bba03ea792b4a05401 Mon Sep 17 00:00:00 2001 From: Adam Thiede Date: Fri, 1 Mar 2024 09:54:47 -0600 Subject: [PATCH 07/11] fix postmarketos logos (#742) --- src/logo/ascii/postmarketos.txt | 36 +++++++++++++-------------- src/logo/ascii/postmarketos_small.txt | 18 +++++++------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/logo/ascii/postmarketos.txt b/src/logo/ascii/postmarketos.txt index 82e995bd7..c2646d49b 100644 --- a/src/logo/ascii/postmarketos.txt +++ b/src/logo/ascii/postmarketos.txt @@ -1,18 +1,18 @@ - /\\ - / \\ - / \\ - / \\ - / \\ - / \\ - \\ \\ - /\\ \\____ \\ - / \\____ \\ \\ - / / \\ \\ - / / \\ ___\\ - / / \\ / ____ - / / \\/ / \\ - / / __________/ \\ - / \\ \\ \\ - / \\ \\ \\ - / / / \\ -/___________/ /____________________\\ + /\ + / \ + / \ + / \ + / \ + / \ + \ \ + /\ \____ \ + / \____ \ \ + / / \ \ + / / \ ___\ + / / \ / ____ + / / \/ / \ + / / __________/ \ + / \ \ \ + / \ \ \ + / / / \ +/___________/ /____________________\ diff --git a/src/logo/ascii/postmarketos_small.txt b/src/logo/ascii/postmarketos_small.txt index 0515ff07e..0d8439d63 100644 --- a/src/logo/ascii/postmarketos_small.txt +++ b/src/logo/ascii/postmarketos_small.txt @@ -1,9 +1,9 @@ - /\\ - / \\ - / \\ - \\__ \\ - /\\__ \\ _\\ - / / \\/ __ - / / ____/ \\ - / \\ \\ \\ -/_____/ /________\\ + /\ + / \ + / \ + \__ \ + /\__ \ _\ + / / \/ __ + / / ____/ \ + / \ \ \ +/_____/ /________\ From 4bd4ec28974a9cbfc6aab2d3bd211de663b9f7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 2 Mar 2024 18:32:31 +0800 Subject: [PATCH 08/11] Terminal (Linux): detect zellij version --- src/detection/terminalshell/terminalshell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 9d645356a..8fc56d34b 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -437,6 +437,15 @@ static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version) return version->length > 0; } +static bool getTerminalVersionZellij(FFstrbuf* exe, FFstrbuf* version) +{ + if(!getExeVersionRaw(exe, version)) return false; + + // zellij 0.39.2 + ffStrbufSubstrAfterFirstC(version, ' '); + return version->length > 0; +} + #ifdef _WIN32 static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version) @@ -554,6 +563,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufStartsWithIgnCaseS(processName, "screen")) return getTerminalVersionScreen(exe, version); + if(ffStrbufStartsWithIgnCaseS(processName, "zellij")) + return getTerminalVersionZellij(exe, version); + const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION"); if(termProgramVersion) { From c2f815f5baf3b1336f52c6f892315e44dec66ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 2 Mar 2024 18:33:14 +0800 Subject: [PATCH 09/11] Uptime (Android): fix implementation Regression of 41fed1da5f4c4d88b174ebf7b5b4a43c80c5a57a --- src/detection/uptime/uptime_linux.c | 30 ++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/detection/uptime/uptime_linux.c b/src/detection/uptime/uptime_linux.c index 79bb5580c..ab85dd87a 100644 --- a/src/detection/uptime/uptime_linux.c +++ b/src/detection/uptime/uptime_linux.c @@ -6,20 +6,32 @@ const char* ffDetectUptime(FFUptimeResult* result) { + #ifndef __ANDROID__ // cat: /proc/uptime: Permission denied + // #620 char buf[64]; ssize_t nRead = ffReadFileData("/proc/uptime", sizeof(buf) - 1, buf); - if(nRead < 0) - return "ffReadFileData(\"/proc/uptime\", sizeof(buf) - 1, buf) failed"; - buf[nRead] = '\0'; + if(nRead > 0) + { + buf[nRead] = '\0'; - char *err = NULL; - double sec = strtod(buf, &err); - if(err != buf) - result->uptime = (uint64_t) (sec * 1000); - else - return "strtod(buf, &err) failed"; + char *err = NULL; + double sec = strtod(buf, &err); + if(err != buf) + { + result->uptime = (uint64_t) (sec * 1000); + result->bootTime = ffTimeGetNow() + result->uptime; + return NULL; + } + } + #endif + + struct timespec uptime; + if (clock_gettime(CLOCK_BOOTTIME, &uptime) != 0) + return "clock_gettime(CLOCK_BOOTTIME) failed"; + + result->uptime = (uint64_t) uptime.tv_sec * 1000 + (uint64_t) uptime.tv_nsec / 1000000; result->bootTime = ffTimeGetNow() + result->uptime; return NULL; From d497853af594ad8b8af5df0725dcb9e4582a267e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 1 Mar 2024 20:17:12 +0800 Subject: [PATCH 10/11] Doc: update changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d51c7b33f..669f7ac34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 2.8.7 + +Bugfixes: +* Fix max CPU frequency detection for some cases (CPU, Linux) +* Fix some memory leaks +* Fix ddcutil 2.1 compatibility (Brightness, Linux) +* Workaround `permission denied` error when reading `/proc/uptime` (Uptime, Android) + +Features: +* Support zellij version detection (Linux, Terminal) + +Logo: +* Fix PostMarketOS + # 2.8.6 Changes: From 7504484f213b8cb37cf8b2099b55b9cf608ce5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 2 Mar 2024 18:46:48 +0800 Subject: [PATCH 11/11] Release: v2.8.7 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dbd6c1bd..aff9a5a7f 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 2.8.6 + VERSION 2.8.7 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"