From 8f0fc2ce6a6e90685749892498af3cdbd87f43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 30 Aug 2023 17:33:38 +0200 Subject: [PATCH 1/5] linux: right align IO_READ_RATE column title --- linux/LinuxProcess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index e348f9ab1..3321f512a 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -76,7 +76,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [RBYTES] = { .name = "RBYTES", .title = " IO_R ", .description = "Bytes of read(2) I/O for the process", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, [WBYTES] = { .name = "WBYTES", .title = " IO_W ", .description = "Bytes of write(2) I/O for the process", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, [CNCLWB] = { .name = "CNCLWB", .title = " IO_C ", .description = "Bytes of cancelled write(2) I/O", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, - [IO_READ_RATE] = { .name = "IO_READ_RATE", .title = " DISK READ ", .description = "The I/O rate of read(2) in bytes per second for the process", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, + [IO_READ_RATE] = { .name = "IO_READ_RATE", .title = " DISK READ ", .description = "The I/O rate of read(2) in bytes per second for the process", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, [IO_WRITE_RATE] = { .name = "IO_WRITE_RATE", .title = " DISK WRITE ", .description = "The I/O rate of write(2) in bytes per second for the process", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, [IO_RATE] = { .name = "IO_RATE", .title = " DISK R/W ", .description = "Total I/O rate in bytes per second", .flags = PROCESS_FLAG_IO, .defaultSortDesc = true, }, [CGROUP] = { .name = "CGROUP", .title = "CGROUP (raw)", .description = "Which cgroup the process is in", .flags = PROCESS_FLAG_LINUX_CGROUP, .autoWidth = true, }, From a055c18a82500c31684fb1e59c5500f3fba94c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 30 Aug 2023 17:37:31 +0200 Subject: [PATCH 2/5] Fix leak in ScreensPanel --- ScreensPanel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ScreensPanel.c b/ScreensPanel.c index d00388098..1bf557a38 100644 --- a/ScreensPanel.c +++ b/ScreensPanel.c @@ -48,7 +48,6 @@ static const char* const DynamicFunctions[] = {" ", "Rename", " ", " static void ScreensPanel_delete(Object* object) { Panel* super = (Panel*) object; - ScreensPanel* this = (ScreensPanel*) object; /* do not delete screen settings still in use */ int n = Panel_size(super); @@ -57,7 +56,7 @@ static void ScreensPanel_delete(Object* object) { item->ss = NULL; } - free(this); + Panel_delete(object); } static HandlerResult ScreensPanel_eventHandlerRenaming(Panel* super, int ch) { From 3bcb76e81cf4338a1dc3c78609eefda16e9c878a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 30 Aug 2023 17:45:11 +0200 Subject: [PATCH 3/5] Fix typo --- pcp/screens/devices | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcp/screens/devices b/pcp/screens/devices index f9f6bc0c1..7399f82f7 100644 --- a/pcp/screens/devices +++ b/pcp/screens/devices @@ -110,5 +110,5 @@ qlen.metric = disk.dev.avg_qlen util.heading = UTIL% util.metric = 100 * disk.dev.util -util.caption = Perentage device utilitization +util.caption = Perentage device utilization util.format = percent From 628caf35632ddb358cd389aa6d37e3245790cf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 30 Aug 2023 17:50:50 +0200 Subject: [PATCH 4/5] CI: dump config.log on configure failure --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 509e01202..2364db1e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror --enable-affinity --disable-unicode --disable-sensors + run: ./configure --enable-werror --enable-affinity --disable-unicode --disable-sensors || (cat config.log; exit 1) - name: Enable compatibility modes run: | sed -i 's/#define HAVE_FSTATAT 1/#undef HAVE_FSTATAT/g' config.h @@ -44,7 +44,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror --enable-affinity --disable-unicode --disable-sensors + run: ./configure --enable-werror --enable-affinity --disable-unicode --disable-sensors || ( cat config.log; exit 1; ) - name: Build run: make -k - name: Distcheck @@ -63,7 +63,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-delayacct --enable-sensors --enable-capabilities + run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-delayacct --enable-sensors --enable-capabilities || ( cat config.log; exit 1; ) - name: Build run: make -k - name: Distcheck @@ -85,7 +85,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-delayacct --enable-sensors --enable-capabilities + run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-delayacct --enable-sensors --enable-capabilities || ( cat config.log; exit 1; ) - name: Build run: make -k - name: Distcheck @@ -104,7 +104,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-static --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --disable-hwloc --disable-delayacct --enable-sensors --enable-capabilities + run: ./configure --enable-static --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --disable-hwloc --disable-delayacct --enable-sensors --enable-capabilities || ( cat config.log; exit 1; ) - name: Build run: make -k - name: Distcheck @@ -120,7 +120,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror --enable-pcp --enable-unicode + run: ./configure --enable-werror --enable-pcp --enable-unicode || ( cat config.log; exit 1; ) - name: Build run: make -k @@ -140,7 +140,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: scan-build-16 -analyze-headers --status-bugs ./configure --enable-debug --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-delayacct --enable-sensors --enable-capabilities + run: scan-build-16 -analyze-headers --status-bugs ./configure --enable-debug --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-delayacct --enable-sensors --enable-capabilities || ( cat config.log; exit 1; ) - name: Build run: scan-build-16 -analyze-headers --status-bugs make -j"$(nproc)" @@ -155,7 +155,7 @@ jobs: - name: Bootstrap run: ./autogen.sh - name: Configure - run: ./configure --enable-werror + run: ./configure --enable-werror || ( cat config.log; exit 1; ) - name: Build run: make -k - name: Distcheck From 1a2ea95a6a23e5dee9bfc6b1f7afbd8d3a6be430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 30 Aug 2023 17:39:54 +0200 Subject: [PATCH 5/5] CI: build and run htop with sanitizer --- .github/workflows/ci.yml | 36 ++++++++++++++++++++ .github/workflows/htoprc | 71 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 .github/workflows/htoprc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2364db1e9..6833f07d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,6 +144,42 @@ jobs: - name: Build run: scan-build-16 -analyze-headers --status-bugs make -j"$(nproc)" + build-ubuntu-latest-clang-sanitizer: + runs-on: ubuntu-latest + env: + CC: clang-16 + CFLAGS: '-O1 -g -ftrivial-auto-var-init=pattern -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-address-use-after-return=always -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=nullability -fsanitize=implicit-conversion -fsanitize=integer -fsanitize=float-divide-by-zero -fsanitize=local-bounds' + LDFLAGS: '-ftrivial-auto-var-init=pattern -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-address-use-after-return=always -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=nullability -fsanitize=implicit-conversion -fsanitize=integer -fsanitize=float-divide-by-zero -fsanitize=local-bounds' + ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 + UBSAN_OPTIONS: print_stacktrace=1:print_summary=1:halt_on_error=1 + TERM: xterm-color + HTOPRC: .github/workflows/htoprc + steps: + - uses: actions/checkout@v3 + - name: install clang repo + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main' -y + sudo apt-get update -q + - name: Install LLVM Toolchain + run: sudo apt-get install --no-install-recommends clang-16 libclang-rt-16-dev llvm-16 + - name: Install Dependencies + run: sudo apt-get install --no-install-recommends libncursesw5-dev libhwloc-dev libnl-3-dev libnl-genl-3-dev libsensors4-dev libcap-dev + - name: Bootstrap + run: ./autogen.sh + - name: Configure + run: ./configure --enable-werror --enable-openvz --enable-vserver --enable-ancient-vserver --enable-unicode --enable-hwloc --enable-delayacct --enable-sensors --enable-capabilities || ( cat config.log; exit 1; ) + - name: Build + run: make -k + - name: Run sanitized htop (1) + run: ./htop -h + - name: Run sanitized htop (2) + run: ./htop -n 5 + - name: Run sanitized htop (3) + run: ./htop -n 5 -t + - name: Run sanitized htop (4) + run: ./htop -d 1 -n 50 + build-macos-latest-clang: runs-on: macOS-latest env: diff --git a/.github/workflows/htoprc b/.github/workflows/htoprc new file mode 100644 index 000000000..6c058ecbb --- /dev/null +++ b/.github/workflows/htoprc @@ -0,0 +1,71 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +htop_version=3.3.0-dev +config_reader_min_version=3 +fields=0 48 17 18 38 39 40 2 46 47 49 1 +hide_kernel_threads=1 +hide_userland_threads=0 +hide_running_in_container=0 +shadow_other_users=1 +show_thread_names=1 +show_program_path=1 +highlight_base_name=1 +highlight_deleted_exe=1 +shadow_distribution_path_prefix=1 +highlight_megabytes=1 +highlight_threads=1 +highlight_changes=1 +highlight_changes_delay_secs=5 +find_comm_in_cmdline=1 +strip_exe_from_cmdline=1 +show_merged_command=1 +header_margin=1 +screen_tabs=1 +detailed_cpu_time=1 +cpu_count_from_one=0 +show_cpu_usage=1 +show_cpu_frequency=1 +show_cpu_temperature=1 +degree_fahrenheit=0 +update_process_names=1 +account_guest_in_cpu_meter=1 +color_scheme=0 +enable_mouse=1 +delay=15 +hide_function_bar=0 +header_layout=two_50_50 +column_meters_0=LeftCPUs4 CPU Memory Swap MemorySwap Zram Clock Date DateTime ZFSARC ZFSCARC SELinux SystemdUser FileDescriptors +column_meter_modes_0=1 1 1 1 1 1 2 2 2 2 2 2 2 2 +column_meters_1=RightCPUs4 Tasks LoadAverage Load Uptime Battery System HugePages Hostname Blank PressureStallCPUSome PressureStallIOSome PressureStallIOFull PressureStallIRQFull PressureStallMemorySome PressureStallMemoryFull DiskIO NetworkIO +column_meter_modes_1=1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 +tree_view=0 +sort_key=46 +tree_sort_key=0 +sort_direction=-1 +tree_sort_direction=1 +tree_view_always_by_pid=0 +all_branches_collapsed=0 +screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command +.sort_key=PERCENT_CPU +.tree_sort_key=PID +.tree_view_always_by_pid=0 +.tree_view=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 +screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command +.sort_key=IO_RATE +.tree_sort_key=PID +.tree_view_always_by_pid=0 +.tree_view=0 +.sort_direction=-1 +.tree_sort_direction=1 +.all_branches_collapsed=0 +screen:Dump=PID SCHEDULERPOLICY SYSCR CGROUP CCGROUP OOM IO_PRIORITY PERCENT_CPU_DELAY CTXT SECATTR CWD AUTOGROUP_ID Command +.sort_key=PID +.tree_sort_key=PID +.tree_view_always_by_pid=0 +.tree_view=0 +.sort_direction=1 +.tree_sort_direction=1 +.all_branches_collapsed=0