Skip to content

Commit

Permalink
Merge branch 'htop-dev:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 authored Mar 25, 2024
2 parents ab4c4d6 + 484f029 commit e460e7b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
open_collective: htop
custom: ["https://hcb.hackclub.com/donations/start/htop"]
35 changes: 15 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ jobs:
build-ubuntu-latest-minimal-clang:
runs-on: ubuntu-latest
env:
CC: clang-16
CC: clang-18
steps:
- uses: actions/checkout@v4
- 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 add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' -y
sudo apt-get update -q
- name: Install Dependencies
run: sudo apt-get install --no-install-recommends clang-16 libncursesw5-dev
run: sudo apt-get install --no-install-recommends clang-18 libncursesw5-dev
- name: Bootstrap
run: ./autogen.sh
- name: Configure
Expand Down Expand Up @@ -72,16 +72,16 @@ jobs:
build-ubuntu-latest-full-featured-clang:
runs-on: ubuntu-latest
env:
CC: clang-16
CC: clang-18
steps:
- uses: actions/checkout@v4
- 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 add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' -y
sudo apt-get update -q
- name: Install Dependencies
run: sudo apt-get install --no-install-recommends clang-16 libncursesw5-dev libhwloc-dev libnl-3-dev libnl-genl-3-dev libsensors4-dev libcap-dev
run: sudo apt-get install --no-install-recommends clang-18 libncursesw5-dev libhwloc-dev libnl-3-dev libnl-genl-3-dev libsensors4-dev libcap-dev
- name: Bootstrap
run: ./autogen.sh
- name: Configure
Expand Down Expand Up @@ -127,27 +127,27 @@ jobs:
build-ubuntu-latest-clang-analyzer:
runs-on: ubuntu-latest
env:
CC: clang-16
CC: clang-18
steps:
- uses: actions/checkout@v4
- 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 add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' -y
sudo apt-get update -q
- name: Install Dependencies
run: sudo apt-get install --no-install-recommends clang-16 clang-tools-16 libncursesw5-dev libnl-3-dev libnl-genl-3-dev libsensors4-dev libcap-dev
run: sudo apt-get install --no-install-recommends clang-18 clang-tools-18 libncursesw5-dev libnl-3-dev libnl-genl-3-dev libsensors4-dev libcap-dev
- 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 || ( cat config.log; exit 1; )
run: scan-build-18 -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)"
run: scan-build-18 -analyze-headers --status-bugs make -j"$(nproc)"

build-ubuntu-latest-clang-sanitizer:
runs-on: ubuntu-latest
env:
CC: clang-16
CC: clang-18
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
Expand All @@ -156,18 +156,13 @@ jobs:
HTOPRC: .github/workflows/htoprc
steps:
- uses: actions/checkout@v4
- name: Fix kernel mmap rnd bits
# High entropy setting in GH runner images >= 20240310.1.0
# causes ASAN random segfaults
# https://github.com/actions/runner-images/issues/9491
run: sudo sysctl vm.mmap_rnd_bits=28
- 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 add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 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
run: sudo apt-get install --no-install-recommends clang-18 libclang-rt-18-dev llvm-18
- 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
Expand Down Expand Up @@ -271,7 +266,7 @@ jobs:
CPPFLAGS="-I/usr/pkg/include" ./configure --enable-unicode --enable-werror
gmake -k
build-openbsd-latest-gcc:
build-openbsd-latest-clang:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
Expand Down
2 changes: 1 addition & 1 deletion Process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ void Process_updateExe(Process* this, const char* exe) {
}

void Process_updateCPUFieldWidths(float percentage) {
if (percentage < 99.9F) {
if (!isgreaterequal(percentage, 99.9F)) {
Row_updateFieldWidth(PERCENT_CPU, 4);
Row_updateFieldWidth(PERCENT_NORM_CPU, 4);
return;
Expand Down
5 changes: 5 additions & 0 deletions Row.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ void Row_printLeftAlignedField(RichString* str, int attr, const char* content, u
}

int Row_printPercentage(float val, char* buffer, size_t n, uint8_t width, int* attr) {
assert(n >= 6 && width >= 4 && "Invalid width in Row_printPercentage()");
// truncate in favour of abort in xSnprintf()
width = (uint8_t)CLAMP(width, 4, n - 2);
assert(width < n - 1 && "Insufficient space to print column");

if (isNonnegative(val)) {
if (val < 0.05F)
*attr = CRT_colors[PROCESS_SHADOW];
Expand Down

0 comments on commit e460e7b

Please sign in to comment.