diff --git a/.gitignore b/.gitignore index 51663ca..446fc2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /bwm-ng-0.6.1.tar.gz /v0.6.2.tar.gz +/v0.6.3.tar.gz diff --git a/.rpmlint b/.rpmlint deleted file mode 100644 index a14a960..0000000 --- a/.rpmlint +++ /dev/null @@ -1,9 +0,0 @@ -addFilter("spelling-error %description -l en_US proc -> crop, prov, pro") -addFilter("spelling-error %description -l en_US dev -> deb, derv, div") -addFilter("spelling-error %description -l en_US netstat -> net stat, net-stat, nets tat") -addFilter("spelling-error %description -l en_US getifaddr -> multifaceted") -addFilter("spelling-error %description -l en_US sysctl -> systolic") -addFilter("spelling-error %description -l en_US kstat -> stat, k stat, ks tat") -addFilter("spelling-error %description -l en_US diskstats -> disk stats, disk-stats, disks tats") -addFilter("spelling-error %description -l en_US devstat -> devastate") -addFilter("spelling-error %description -l en_US libstatgrab -> Stalingrad") diff --git a/0001-fix-format-not-a-string-literal.patch b/0001-fix-format-not-a-string-literal.patch new file mode 100644 index 0000000..4fcfb6e --- /dev/null +++ b/0001-fix-format-not-a-string-literal.patch @@ -0,0 +1,53 @@ +From f5793fd6789875bf29b50f7df0e6df24bf797494 Mon Sep 17 00:00:00 2001 +From: Volker Gropp +Date: Mon, 1 Nov 2021 09:39:31 +0100 +Subject: [PATCH] fix: format not a string literal + +... and no format arguments +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=997140 + +Remove unintended files +Signed-off-by: Tim Orling +--- + configure.in | 4 ++-- + src/output.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.in b/configure.in +index 282bf1e..2cd6811 100644 +--- a/configure.in ++++ b/configure.in +@@ -12,7 +12,7 @@ AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[enable debug (default: no + echo "enable debugging info: $enableval" + if [ test $enableval = "yes" ]; then + if test -z ${CFLAGS}; then +- CFLAGS="-g3 -Wall" ++ CFLAGS="-g3 -Werror=format-security -Wall" + else + CFLAGS="-g3 ${CFLAGS}" + fi +@@ -20,7 +20,7 @@ if [ test $enableval = "yes" ]; then + fi + ],[ + if test -z "${CFLAGS}"; then +- CFLAGS="-O2 -Wall" ++ CFLAGS="-O2 -Wall -Werror=format-security" + fi + ]) + +diff --git a/src/output.c b/src/output.c +index f5f01cd..81fdcef 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -151,7 +151,7 @@ int print_header(int option) { + erase(); + mvwprintw(stdscr,1,2,"bwm-ng v" VERSION" (probing every %2.3fs), press 'h' for help",(float)delay/1000); + mvwprintw(stdscr,2,2,"input: %s type: %s",input2str(),output_type2str()); +- wprintw(stdscr,show_all_if2str()); ++ wprintw(stdscr,"%s",show_all_if2str()); + mvwprintw(stdscr,3,2,"%c iface Rx Tx Total",(char)IDLE_CHARS[option]); + /* go to next char for next run */ + option++; +-- +2.39.2 + diff --git a/0002-fix-use-after-free-in-proc_diskstats-on-error.patch b/0002-fix-use-after-free-in-proc_diskstats-on-error.patch new file mode 100644 index 0000000..b57ee7f --- /dev/null +++ b/0002-fix-use-after-free-in-proc_diskstats-on-error.patch @@ -0,0 +1,26 @@ +From 227b1de2d4aff2621c032980915770953e97a0a3 Mon Sep 17 00:00:00 2001 +From: Volker Gropp +Date: Sat, 24 Sep 2022 15:04:15 +0200 +Subject: [PATCH 1/3] fix use after free in proc_diskstats on error + +--- + src/input/proc_diskstats.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/input/proc_diskstats.c b/src/input/proc_diskstats.c +index 22b872c..482be1a 100644 +--- a/src/input/proc_diskstats.c ++++ b/src/input/proc_diskstats.c +@@ -158,8 +158,8 @@ void get_disk_stats_proc (char verbose) { + } else { + /* neither new nor old /proc/partitions nor /proc/diskstats */ + free(name); +- free(buffer); + deinit(1, "wrong format of procfile. %i: %s\n",n,buffer); ++ free(buffer); + } + } + } +-- +2.39.2 + diff --git a/0003-fix-missing-device-number-in-fbsd-devstat-input.patch b/0003-fix-missing-device-number-in-fbsd-devstat-input.patch new file mode 100644 index 0000000..0e9e243 --- /dev/null +++ b/0003-fix-missing-device-number-in-fbsd-devstat-input.patch @@ -0,0 +1,31 @@ +From bd878c0f66ed2ab6245485ae901446f7e8e894db Mon Sep 17 00:00:00 2001 +From: Volker Gropp +Date: Sat, 24 Sep 2022 15:11:55 +0200 +Subject: [PATCH 2/3] fix missing device number in fbsd devstat input + +--- + src/input/devstat.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/input/devstat.c b/src/input/devstat.c +index b87130d..77a5800 100644 +--- a/src/input/devstat.c ++++ b/src/input/devstat.c +@@ -65,7 +65,13 @@ void get_iface_stats_devstat (char verbose) { + tmp_if_stats.packets.out=dev_ptr->operations[DEVSTAT_WRITE]; + #endif + tmp_if_stats.errors.in = tmp_if_stats.errors.out = 0; +- hidden_if = process_if_data (hidden_if, tmp_if_stats, &stats, dev_ptr->device_name, current_if_num, verbose,(tmp_if_stats.bytes.in != 0 || tmp_if_stats.bytes.out != 0)); ++ ++ size_t needed = snprintf(NULL, 0, "%s%d", dev_ptr->device_name,dev_ptr->unit_number); ++ char *device_fullname = malloc(needed); ++ sprintf(device_fullname,"%s%d", dev_ptr->device_name,dev_ptr->unit_number); ++ ++ hidden_if = process_if_data (hidden_if, tmp_if_stats, &stats, device_fullname, current_if_num, verbose,(tmp_if_stats.bytes.in != 0 || tmp_if_stats.bytes.out != 0)); ++ free(device_fullname); + + } + finish_iface_stats (verbose, stats, hidden_if,current_if_num); +-- +2.39.2 + diff --git a/0004-fix-multiple-fflush-might-miss-some-branch-and-html-.patch b/0004-fix-multiple-fflush-might-miss-some-branch-and-html-.patch new file mode 100644 index 0000000..f98dd74 --- /dev/null +++ b/0004-fix-multiple-fflush-might-miss-some-branch-and-html-.patch @@ -0,0 +1,51 @@ +From 05f18a243fd12c0e86cdecb746324595352fae32 Mon Sep 17 00:00:00 2001 +From: Volker Gropp +Date: Sat, 24 Sep 2022 15:22:06 +0200 +Subject: [PATCH 3/3] fix multiple fflush might miss some branch and html + output + +--- + src/output.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/output.c b/src/output.c +index 81fdcef..4e42fdb 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -537,6 +537,7 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee + values2str(1,stats,full_stats,multiplier,buffer,49), + ((stats.errors.out || stats.errors.in) && output_unit!=ERRORS_OUT) ? "error" : "dummy" ); + fprintf(tmp_out_file,"%s\n",values2str(2,stats,full_stats,multiplier,buffer,49)); ++ fflush(tmp_out_file); + break; + #endif + #ifdef CSV +@@ -565,7 +566,6 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee + #endif + fprintf(tmp_out_file,"%.2f%c%.2f%c%.2f%c%llu%c%llu\n",(double)(stats_csv->bytes.out*multiplier*8),csv_char,(double)(stats_csv->bytes.in*multiplier*8), + csv_char,(double)((stats_csv->bytes.out+stats_csv->bytes.in)*multiplier*8),csv_char,stats_csv->bytes.in*8,csv_char,stats_csv->bytes.out*8); +- fflush(tmp_out_file); + } else { + stats_csv = &full_stats.sum; + #if !NETSTAT_BSD_BYTES && !NETSTAT_NETBSD && NETSTAT +@@ -576,7 +576,6 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee + /* show packets and errors */ + fprintf(tmp_out_file,"%llu%c%llu%c%llu",stats_csv->packets.out,csv_char,stats_csv->packets.in,csv_char,(stats_csv->packets.out+stats_csv->packets.in)); + fprintf(tmp_out_file,"%c%llu%c%llu\n",csv_char,stats_csv->errors.out,csv_char,stats_csv->errors.in); +- fflush(tmp_out_file); + } + } else { /* MAX_OUT or AVG_OUT */ + if (output_type == MAX_OUT) +@@ -600,8 +599,8 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee + /* show packets/s and errors/s */ + fprintf(tmp_out_file,"%.2Lf%c%.2Lf%c%.2Lf",stats_csv_d.packets.out,csv_char,stats_csv_d.packets.in,csv_char,stats_csv_d.packets.total); + fprintf(tmp_out_file,"%c%.2Lf%c%.2Lf\n",csv_char,stats_csv_d.errors.out,csv_char,stats_csv_d.errors.in); +- fflush(tmp_out_file); + } ++ fflush(tmp_out_file); + break; + #endif + } +-- +2.39.2 + diff --git a/bwm-ng-configure-c99.patch b/bwm-ng-configure-c99.patch deleted file mode 100644 index 1882c33..0000000 --- a/bwm-ng-configure-c99.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 21ef57516576c09d7023d0906fe7774e38f99bb7 Mon Sep 17 00:00:00 2001 -From: Florian Weimer -Date: Fri, 6 Sep 2019 12:54:48 +0200 -Subject: [PATCH] AC_QEF_C_NORETURN: Include for exit - -The exit function is declared in , not . Without -this change, the autoconf check will always fail with strict C99 -compilers which do not support implicit function declarations. ---- - acinclude.m4 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/acinclude.m4 b/acinclude.m4 -index 77fdec8..d069e52 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -148,7 +148,7 @@ AC_DEFUN([AC_QEF_C_NORETURN], - AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts noreturn attribute) - AC_CACHE_VAL(qef_cv_c_noreturn, - [qef_cv_c_noreturn=no --AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - void f (void) __attribute__ ((noreturn)); - void f (void) - { diff --git a/bwm-ng.spec b/bwm-ng.spec index 5811da2..de56a8c 100644 --- a/bwm-ng.spec +++ b/bwm-ng.spec @@ -1,17 +1,20 @@ Name: bwm-ng -Version: 0.6.2 -Release: 8%{?dist} +Version: 0.6.3 +Release: 1%{?dist} Summary: Bandwidth Monitor NG License: GPL-2.0-or-later URL: https://github.com/vgropp/bwm-ng Source0: https://github.com/vgropp/%{name}/archive/v%{version}.tar.gz Source1: bwm-ng.conf -Patch0: bwm-ng-configure-c99.patch +Patch0: 0001-fix-format-not-a-string-literal.patch +Patch1: 0002-fix-use-after-free-in-proc_diskstats-on-error.patch +Patch2: 0003-fix-missing-device-number-in-fbsd-devstat-input.patch +Patch3: 0004-fix-multiple-fflush-might-miss-some-branch-and-html-.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc BuildRequires: ncurses-devel -BuildRequires: make +BuildRequires: make Requires: hostname Requires: procps @@ -31,6 +34,9 @@ Features: %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build ./autogen.sh @@ -59,6 +65,13 @@ install -pDm644 bwm-ng.1 %{buildroot}%{_mandir}/man1/bwm-ng.1 %{_mandir}/man1/bwm-ng.1* %changelog +* Fri Feb 24 2023 Tim Orling - 0.6.3-1 +- Update to 0.6.3 (rhbz 2113135) +- Drop C99 patch (was https://github.com/vgropp/bwm-ng/pull/25) +- Add patch from 'fix-wsecurity' PR (https://github.com/vgropp/bwm-ng/pull/37) +- Add patches from 'fix-freebsd' PR (https://github.com/vgropp/bwm-ng/pull/42) +- Drop .rpmlint (filters not used) + * Fri Feb 24 2023 Tim Orling - 0.6.2-9 - migrated to SPDX license diff --git a/sources b/sources index ea74ee7..0384751 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v0.6.2.tar.gz) = 4a7f141692f96dfab0c1729a7df36f5213a75ddb891b967b2cf951419daea7b84354c276705a0ee7c09f4ed26948ca068f65a04b8f9d18b2b8ed2df97b5e3b0a +SHA512 (v0.6.3.tar.gz) = 85ce29e6ffa9643b4e7c1d731f4e928ddca8cfdc71c86b65ec4e55058b951eb8da9ab80139145300518223589d5fece5bdc11ede91a1ea394d569993ccdb0ab8