diff --git a/SOURCES/procps-ng-3.3.15-pgrep-uid-gid-overflow.patch b/SOURCES/procps-ng-3.3.15-pgrep-uid-gid-overflow.patch new file mode 100644 index 0000000..3c92df6 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-pgrep-uid-gid-overflow.patch @@ -0,0 +1,57 @@ +diff -up ./pgrep.c.ori ./pgrep.c +--- ./pgrep.c.ori 2022-08-17 15:38:29.655530551 +0200 ++++ ./pgrep.c 2022-08-17 15:38:53.702661752 +0200 +@@ -204,8 +204,12 @@ static int strict_atol (const char *rest + + for ( ; *str; ++str) { + if (! isdigit (*str)) +- return (0); ++ return 0; ++ if (res >= LONG_MAX / 10) ++ return 0; + res *= 10; ++ if (res >= LONG_MAX - (*str - '0')) ++ return 0; + res += *str - '0'; + } + *value = sign * res; +@@ -280,7 +284,7 @@ static int conv_uid (const char *restric + xwarnx(_("invalid user name: %s"), name); + return 0; + } +- e->num = (int) pwd->pw_uid; ++ e->num = pwd->pw_uid; + return 1; + } + +@@ -297,7 +301,7 @@ static int conv_gid (const char *restric + xwarnx(_("invalid group name: %s"), name); + return 0; + } +- e->num = (int) grp->gr_gid; ++ e->num = grp->gr_gid; + return 1; + } + +diff -up ./proc/readproc.h.ori ./proc/readproc.h +--- ./proc/readproc.h.ori 2018-05-19 00:04:15.218532055 +0200 ++++ ./proc/readproc.h 2022-08-17 15:38:53.702661752 +0200 +@@ -159,12 +159,12 @@ typedef struct proc_t { + session, // stat session id + nlwp, // stat,status number of threads, or 0 if no clue + tgid, // (special) thread group ID, the POSIX PID (see also: tid) +- tty, // stat full device number of controlling terminal +- /* FIXME: int uids & gids should be uid_t or gid_t from pwd.h */ +- euid, egid, // stat(),status effective +- ruid, rgid, // status real +- suid, sgid, // status saved +- fuid, fgid, // status fs (used for file access only) ++ tty; // stat full device number of controlling terminal ++ uid_t euid; gid_t egid; // stat(),status effective ++ uid_t ruid; gid_t rgid; // status real ++ uid_t suid; gid_t sgid; // status saved ++ uid_t fuid; gid_t fgid; // status fs (used for file access only) ++ int + tpgid, // stat terminal process group id + exit_signal, // stat might not be SIGCHLD + processor; // stat current (or most recent?) CPU diff --git a/SOURCES/procps-ng-3.3.15-sysctl-config-dir-order.patch b/SOURCES/procps-ng-3.3.15-sysctl-config-dir-order.patch new file mode 100644 index 0000000..3e0bf97 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-sysctl-config-dir-order.patch @@ -0,0 +1,96 @@ +diff -up ./NEWS.ori ./NEWS +diff -up ./sysctl.8.ori ./sysctl.8 +--- ./sysctl.8.ori 2018-03-03 07:59:18.064843718 +0100 ++++ ./sysctl.8 2022-07-29 16:33:02.906648974 +0200 +@@ -6,7 +6,7 @@ + .\" but WITHOUT ANY WARRANTY; without even the implied warranty of + .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + .\" GNU General Public License for more details." +-.TH SYSCTL "8" "2018-02-19" "procps-ng" "System Administration" ++.TH SYSCTL "8" "2020-02-27" "procps-ng" "System Administration" + .SH NAME + sysctl \- configure kernel parameters at runtime + .SH SYNOPSIS +@@ -81,10 +81,10 @@ directories in the following list in giv + Once a file of a given filename is loaded, any file of the same name + in subsequent directories is ignored. + .br +-/run/sysctl.d/*.conf +-.br + /etc/sysctl.d/*.conf + .br ++/run/sysctl.d/*.conf ++.br + /usr/local/lib/sysctl.d/*.conf + .br + /usr/lib/sysctl.d/*.conf +@@ -152,6 +152,16 @@ echo 256 > /proc/sys/net/ipv6/neigh/eth0 + .SH FILES + .I /proc/sys + .br ++.I /etc/sysctl.d/*.conf ++.br ++.I /run/sysctl.d/*.conf ++.br ++.I /usr/local/lib/sysctl.d/*.conf ++.br ++.I /usr/lib/sysctl.d/*.conf ++.br ++.I /lib/sysctl.d/*.conf ++.br + .I /etc/sysctl.conf + .SH SEE ALSO + .BR sysctl.conf (5) +diff -up ./sysctl.conf.5.ori ./sysctl.conf.5 +--- ./sysctl.conf.5.ori 2017-12-22 05:13:14.771653252 +0100 ++++ ./sysctl.conf.5 2022-07-29 16:33:02.907648980 +0200 +@@ -51,22 +51,22 @@ to list all possible parameters. The des + .RE + .PP + .SH FILES +-.TP +-/run/sysctl.d/*.conf +-.TQ +-/etc/sysctl.d/*.conf +-.TQ +-/usr/local/lib/sysctl.d/*.conf +-.TQ +-/usr/lib/sysctl.d/*.conf +-.TQ +-/lib/sysctl.d/*.conf +-.TQ +-/etc/sysctl.conf ++.I /etc/sysctl.d/*.conf ++.br ++.I /run/sysctl.d/*.conf ++.br ++.I /usr/local/lib/sysctl.d/*.conf ++.br ++.I /usr/lib/sysctl.d/*.conf ++.br ++.I /lib/sysctl.d/*.conf ++.br ++.I /etc/sysctl.conf ++ + The paths where +-sysctl ++.B sysctl + preload files usually exist. See also +-sysctl ++.B sysctl + option + .IR \-\-system . + .SH SEE ALSO +diff -up ./sysctl.c.ori ./sysctl.c +--- ./sysctl.c.ori 2018-05-17 13:23:41.574213737 +0200 ++++ ./sysctl.c 2022-07-29 16:33:02.907648980 +0200 +@@ -614,8 +614,8 @@ static int PreloadSystem(void) + { + unsigned di, i; + const char *dirs[] = { +- "/run/sysctl.d", + "/etc/sysctl.d", ++ "/run/sysctl.d", + "/usr/local/lib/sysctl.d", + "/usr/lib/sysctl.d", + "/lib/sysctl.d", diff --git a/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch b/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch new file mode 100644 index 0000000..c3799b9 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch @@ -0,0 +1,40 @@ +From 7eade2544e1c45bc516744aeaccc45df1d8f42df Mon Sep 17 00:00:00 2001 +From: Kyle Walker +Date: Tue, 11 Feb 2020 14:30:39 -0500 +Subject: [PATCH] whattime: Refactor the pretty-print evaluation + +This avoids rounding errors such as in the case of 364 days of uptime which +results in only output that prints at the hour and below. +--- + proc/whattime.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/proc/whattime.c b/proc/whattime.c +index c223cad..3e1b65c 100644 +--- a/proc/whattime.c ++++ b/proc/whattime.c +@@ -69,9 +69,18 @@ char *sprint_uptime(int human_readable) { + + if (human_readable) { + updecades = (int) uptime_secs / (60*60*24*365*10); +- upyears = ((int) uptime_secs / (60*60*24*365)) % 10; +- upweeks = ((int) uptime_secs / (60*60*24*7)) % 52; +- updays = ((int) uptime_secs / (60*60*24)) % 7; ++ if (updecades) ++ uptime_secs -= updecades * (60*60*24*365*10); ++ ++ upyears = (int) uptime_secs / (60*60*24*365); ++ if (upyears) ++ uptime_secs -= upyears * (60*60*24*365); ++ ++ upweeks = (int) uptime_secs / (60*60*24*7); ++ if (upweeks) ++ uptime_secs -= upweeks * (60*60*24*7); ++ ++ updays = (int) uptime_secs / (60*60*24); + } + else + updays = (int) uptime_secs / (60*60*24); +-- +2.24.1 + diff --git a/SOURCES/procps-ng-3.3.15-vmstat-omit-first-report.patch b/SOURCES/procps-ng-3.3.15-vmstat-omit-first-report.patch new file mode 100644 index 0000000..87e5b65 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-vmstat-omit-first-report.patch @@ -0,0 +1,147 @@ +diff --git a/vmstat.8 b/vmstat.8 +index fa0938c..fd1078f 100644 +--- a/vmstat.8 ++++ b/vmstat.8 +@@ -87,6 +87,9 @@ Display version information and exit. + .TP + \fB\-h\fR, \fB\-\-help\fR + Display help and exit. ++.TP ++\fB\-y\fR, \fB\-\-no-first\fR ++Omits first report with statistics since system boot. + .PD + .SH "FIELD DESCRIPTION FOR VM MODE" + .SS +diff --git a/vmstat.c b/vmstat.c +index f2aa2f4..07496cd 100644 +--- a/vmstat.c ++++ b/vmstat.c +@@ -75,6 +75,9 @@ static int a_option; + /* "-w" means "wide output" */ + static int w_option; + ++/* "-y" means "skip first output" */ ++static int y_option; ++ + /* "-t" means "show timestamp" */ + static int t_option; + +@@ -104,6 +107,7 @@ static void __attribute__ ((__noreturn__)) + fputs(_(" -S, --unit define display unit\n"), out); + fputs(_(" -w, --wide wide output\n"), out); + fputs(_(" -t, --timestamp show timestamp\n"), out); ++ fputs(_(" -y, --no-first skips first line of output\n"), out); + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); + fputs(USAGE_VERSION, out); +@@ -304,43 +308,47 @@ static void new_format(void) + cpu_zzz, pgpgin, pgpgout, pswpin, pswpout, intr, ctxt, &running, + &blocked, &dummy_1, &dummy_2); + +- if (t_option) { +- (void) time( &the_time ); +- tm_ptr = localtime( &the_time ); +- strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr); +- } ++ if (y_option == 0) { ++ if (t_option) { ++ (void) time( &the_time ); ++ tm_ptr = localtime( &the_time ); ++ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr); ++ } + +- duse = *cpu_use + *cpu_nic; +- dsys = *cpu_sys + *cpu_xxx + *cpu_yyy; +- didl = *cpu_idl; +- diow = *cpu_iow; +- dstl = *cpu_zzz; +- Div = duse + dsys + didl + diow + dstl; +- if (!Div) Div = 1, didl = 1; +- divo2 = Div / 2UL; +- printf(w_option ? wide_format : format, +- running, blocked, +- unitConvert(kb_swap_used), unitConvert(kb_main_free), +- unitConvert(a_option?kb_inactive:kb_main_buffers), +- unitConvert(a_option?kb_active:kb_main_cached), +- (unsigned)( (unitConvert(*pswpin * kb_per_page) * hz + divo2) / Div ), +- (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ), +- (unsigned)( (*pgpgin * hz + divo2) / Div ), +- (unsigned)( (*pgpgout * hz + divo2) / Div ), +- (unsigned)( (*intr * hz + divo2) / Div ), +- (unsigned)( (*ctxt * hz + divo2) / Div ), +- (unsigned)( (100*duse + divo2) / Div ), +- (unsigned)( (100*dsys + divo2) / Div ), +- (unsigned)( (100*didl + divo2) / Div ), +- (unsigned)( (100*diow + divo2) / Div ), +- (unsigned)( (100*dstl + divo2) / Div ) +- ); ++ duse = *cpu_use + *cpu_nic; ++ dsys = *cpu_sys + *cpu_xxx + *cpu_yyy; ++ didl = *cpu_idl; ++ diow = *cpu_iow; ++ dstl = *cpu_zzz; ++ Div = duse + dsys + didl + diow + dstl; ++ if (!Div) Div = 1, didl = 1; ++ divo2 = Div / 2UL; ++ printf(w_option ? wide_format : format, ++ running, blocked, ++ unitConvert(kb_swap_used), unitConvert(kb_main_free), ++ unitConvert(a_option?kb_inactive:kb_main_buffers), ++ unitConvert(a_option?kb_active:kb_main_cached), ++ (unsigned)( (unitConvert(*pswpin * kb_per_page) * hz + divo2) / Div ), ++ (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ), ++ (unsigned)( (*pgpgin * hz + divo2) / Div ), ++ (unsigned)( (*pgpgout * hz + divo2) / Div ), ++ (unsigned)( (*intr * hz + divo2) / Div ), ++ (unsigned)( (*ctxt * hz + divo2) / Div ), ++ (unsigned)( (100*duse + divo2) / Div ), ++ (unsigned)( (100*dsys + divo2) / Div ), ++ (unsigned)( (100*didl + divo2) / Div ), ++ (unsigned)( (100*diow + divo2) / Div ), ++ (unsigned)( (100*dstl + divo2) / Div ) ++ ); + +- if (t_option) { +- printf(" %s", timebuf); +- } ++ if (t_option) { ++ printf(" %s", timebuf); ++ } + +- printf("\n"); ++ printf("\n"); ++ } ++ else ++ num_updates++; + + /* main loop */ + for (i = 1; infinite_updates || i < num_updates; i++) { +@@ -865,6 +873,7 @@ int main(int argc, char *argv[]) + {"timestamp", no_argument, NULL, 't'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'V'}, ++ {"no-first", no_argument, NULL, 'y'}, + {NULL, 0, NULL, 0} + }; + +@@ -877,7 +886,7 @@ int main(int argc, char *argv[]) + atexit(close_stdout); + + while ((c = +- getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts, ++ getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts, + NULL)) != EOF) + switch (c) { + case 'V': +@@ -946,6 +955,11 @@ int main(int argc, char *argv[]) + case 't': + t_option = 1; + break; ++ case 'y': ++ /* Don't display stats since system restart */ ++ y_option = 1; ++ break; ++ + default: + /* no other aguments defined yet. */ + usage(stderr); diff --git a/SPECS/procps-ng.spec b/SPECS/procps-ng.spec index 84dd9f7..a7caab6 100644 --- a/SPECS/procps-ng.spec +++ b/SPECS/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 3.3.15 -Release: 6%{?dist} +Release: 9%{?dist} License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ Group: Applications/System URL: https://sourceforge.net/projects/procps-ng/ @@ -21,6 +21,10 @@ Patch2: procps-ng-3.3.15-pgrep-uid-conversion-overflow.patch Patch3: procps-ng-3.3.15-vmstat-watch-manpage.patch Patch4: procps-ng-3.3.15-pidof-kernel-workers-option.patch Patch5: procps-ng-3.3.15-pidof-separator-option-backport.patch +Patch6: procps-ng-3.3.15-uptime-pretty-mod.patch +Patch7: procps-ng-3.3.15-vmstat-omit-first-report.patch +Patch8: procps-ng-3.3.15-sysctl-config-dir-order.patch +Patch9: procps-ng-3.3.15-pgrep-uid-gid-overflow.patch BuildRequires: ncurses-devel BuildRequires: libtool @@ -163,6 +167,20 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %files i18n -f %{name}.lang %changelog +* Wed Aug 17 2022 Jan Rybar - 3.3.15-9 +- pgrep: backport uid/gid overflow fix +- Resolves: rhbz#1827731 + +* Wed Jul 20 2022 Jan Rybar - 3.3.15-8 +- vmstat: added -y option to omit first report +- Resolves: rhbz#2027350 +- sysctl: backport config directory order, align with systemd +- Resolves: rhbz#2111915 + +* Wed Mar 23 2022 Jan Rybar - 3.3.15-7 +- uptime: human readable data not shown if 364 days up +- Resolves: rhbz#1772999 + * Tue Dec 01 2020 Jan Rybar - 3.3.15-6 - pidof: option for separator collides with other option - Resolves: rhbz#1895985