Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package procps4 for openSUSE:Factory checked 
in at 2023-11-14 21:42:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/procps4 (Old)
 and      /work/SRC/openSUSE:Factory/.procps4.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "procps4"

Tue Nov 14 21:42:12 2023 rev:7 rq:1125582 version:4.0.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/procps4/procps4.changes  2023-09-12 
21:05:24.501579457 +0200
+++ /work/SRC/openSUSE:Factory/.procps4.new.17445/procps4.changes       
2023-11-14 21:42:14.246853939 +0100
@@ -1,0 +2,6 @@
+Mon Nov 13 13:26:05 UTC 2023 - Dr. Werner Fink <wer...@suse.de>
+
+- Add upstream commit as patch 79042e07.patch (boo#1216719)
+- Port patch procps-ng-3.3.9-w-notruncate.diff
+
+-------------------------------------------------------------------

New:
----
  79042e07.patch

BETA DEBUG BEGIN:
  New:
- Add upstream commit as patch 79042e07.patch (boo#1216719)
- Port patch procps-ng-3.3.9-w-notruncate.diff
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ procps4.spec ++++++
--- /var/tmp/diff_new_pack.DJLo2Z/_old  2023-11-14 21:42:17.170962182 +0100
+++ /var/tmp/diff_new_pack.DJLo2Z/_new  2023-11-14 21:42:17.170962182 +0100
@@ -37,6 +37,8 @@
 #Alternate:     
https://gitlab.com/procps-ng/procps/-/archive/v%{version}/procps-v%{version}.tar.gz
 Source2:        procps-rpmlintrc
 Source3:        procps4.keyring
+# PATCH-FIX-USTREAM -- w: Don't crash when using short option
+Patch0:         79042e07.patch
 Patch1:         procps-v3.3.3-ia64.diff
 Patch3:         procps-ng-3.3.9-w-notruncate.diff
 Patch7:         procps-ng-3.3.8-readeof.patch
@@ -130,22 +132,23 @@
 
 %prep
 %setup -q -n procps-ng-%{version}
-%patch1
-%patch3 -p1 -b .trcate
-%patch7 -b .rof
-%patch8 -b .cache
-%patch11
-%patch13 -b .column
-%patch14 -b .ovrflw
-%patch17 -b .sysctl
-%patch18
-%patch20 -b .p20
-%patch21
-%patch28
-%patch31 -p1
-%patch32 -b .p32
-%patch33 -b .pmap4us
-%patch37
+%patch -P0 -p1
+%patch -P1
+%patch -P3 -p1 -b .trcate
+%patch -P7 -b .rof
+%patch -P8 -b .cache
+%patch -P11
+%patch -P13 -b .column
+%patch -P14 -b .ovrflw
+%patch -P17 -b .sysctl
+%patch -P18
+%patch -P20 -b .p20
+%patch -P21
+%patch -P28
+%patch -P31 -p1
+%patch -P32 -b .p32
+%patch -P33 -b .pmap4us
+%patch -P37
 
 %build
 test -s .tarball-version || echo %{version} > .tarball-version

++++++ 79042e07.patch ++++++
>From 79042e07fab9956135a21b1df7a69d1fbde7ef79 Mon Sep 17 00:00:00 2001
From: Craig Small <csm...@dropbear.xyz>
Date: Tue, 12 Sep 2023 16:59:18 +1000
Subject: [PATCH] ps: Don't crash when using short option

ps would crash with the -si or -sf options with systemd enabled.
The issue was the utmp wasn't filled in, the long option checked, the
short option did not.

Refactored the showinfo() function so instead of a branch with duplicate
prints for the items in both long and short we just branch on the items
for long output.

Also, made the function prototypes not dependendent on systemd enabled,
it was too messy that way and passing a char* NULL is not really going
to hurt anything.

References:
 #301

Signed-off-by: Craig Small <csm...@dropbear.xyz>
---
 NEWS    |  1 +
 src/w.c | 61 ++++++++++++++++++++-------------------------------------
 2 files changed, 22 insertions(+), 40 deletions(-)

|diff --git a/NEWS b/NEWS
|index 4ad9f74e..883f9139 100644
|--- a/NEWS
|+++ b/NEWS
|@@ -1,5 +1,6 @@
| procps-ng-NEXT
| ---------------
|+  * w: Don't segfault with -s option                       issue #301
| 
| procps-ng-4.0.4
| ---------------
diff --git a/src/w.c b/src/w.c
index fd6e75f7..e2d754b5 100644
--- a/src/w.c
+++ b/src/w.c
@@ -207,9 +207,7 @@ static void print_display_or_interface(const char *restrict 
host, int len, int r
 
 /* This routine prints either the hostname or the IP address of the remote */
 static void print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
                       const char *session,
-#endif
                       const utmp_t *restrict const u, const int ip_addresses, 
const int fromlen) {
 #if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
         if (session) {
@@ -508,11 +506,10 @@ static int find_best_proc(
 #undef PIDS_GETSTR
 }
 
+
 static void showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
             const char *session, const char *name,
-#endif
-            utmp_t * u, int formtype, int maxcmd, int from,
+            utmp_t * u, const int longform, int maxcmd, int from,
             const int userlen, const int fromlen, const int ip_addresses,
             const int pids)
 {
@@ -575,25 +572,20 @@ static void showinfo(
     /* force NUL term for printf */
     uname[UT_NAMESIZE] = '\0';
 
-    if (formtype) {
-        printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
+    printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
+    if (from)
+        print_from(session, NULL, ip_addresses, fromlen);
+
+    /* login time */
+    if (longform) {
 #if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
         if (session) {
             uint64_t ltime;
 
-            if (from)
-              print_from(session, NULL, ip_addresses, fromlen);
-
             sd_session_get_start_time(session, &ltime);
             print_logintime(ltime/((uint64_t) 1000000ULL), stdout);
         } else {
 #endif
-            if (from)
-                print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
-                          NULL,
-#endif
-                          u, ip_addresses, fromlen);
 
 #ifdef HAVE_UTMPX_H
             print_logintime(u->ut_tv.tv_sec, stdout);
@@ -603,11 +595,16 @@ static void showinfo(
 #if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
         }
 #endif
-        if (u && *u->ut_line == ':')
-            /* idle unknown for xdm logins */
-            printf(" ?xdm? ");
-        else
-            print_time_ival7(idletime(tty), 0, stdout);
+    }
+    /* idle */
+    if (u && *u->ut_line == ':')
+        /* idle unknown for xdm logins */
+        printf(" ?xdm? ");
+    else
+        print_time_ival7(idletime(tty), 0, stdout);
+
+    /* jpcpu/pcpu */
+    if (longform) {
         print_time_ival7(jcpu / hertz, (jcpu % hertz) * (100. / hertz),
                  stdout);
         if (pcpu > 0)
@@ -616,20 +613,8 @@ static void showinfo(
                              stdout);
         else
             printf("   ?   ");
-    } else {
-        printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
-        if (from)
-           print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
-                      NULL,
-#endif
-                      u, ip_addresses, fromlen);
-        if (u && *u->ut_line == ':')
-            /* idle unknown for xdm logins */
-            printf(" ?xdm? ");
-        else
-            print_time_ival7(idletime(tty), 0, stdout);
     }
+    /* what */
     if (pids) {
         pid_t ut_pid = -1;
         if (u)
@@ -798,9 +783,9 @@ int main(int argc, char **argv)
                 * headers. Try to keep alignment intact.  */
                printf(_("%-*s TTY      "), userlen, _("USER"));
                if (from)
-                       printf("%-*s", fromlen - 1, _("FROM"));
+                       printf("%-*s", fromlen, _("FROM"));
                if (longform)
-                       printf(_("  LOGIN@   IDLE   JCPU   PCPU WHAT\n"));
+                       printf(_(" LOGIN@   IDLE   JCPU   PCPU  WHAT\n"));
                else
                        printf(_("   IDLE WHAT\n"));
        }
@@ -857,9 +842,7 @@ int main(int argc, char **argv)
                                continue;
                        if (!strncmp(u->ut_user, user, UT_NAMESIZE))
                                showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
                                         NULL, NULL,
-#endif
                                         u, longform, maxcmd, from, userlen,
                                         fromlen, ip_addresses, pids);
                }
@@ -876,9 +859,7 @@ int main(int argc, char **argv)
                                continue;
                        if (*u->ut_user)
                                showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
                                         NULL, NULL,
-#endif
                                         u, longform, maxcmd, from, userlen,
                                         fromlen, ip_addresses, pids);
                }
-- 
GitLab


++++++ procps-ng-3.3.9-w-notruncate.diff ++++++
--- /var/tmp/diff_new_pack.DJLo2Z/_old  2023-11-14 21:42:17.230964403 +0100
+++ /var/tmp/diff_new_pack.DJLo2Z/_new  2023-11-14 21:42:17.234964550 +0100
@@ -4,7 +4,7 @@
  2 files changed, 26 insertions(+), 4 deletions(-)
 
 --- procps-ng-4.0.4/man/w.1
-+++ procps-ng-4.0.4/man/w.1    2023-09-12 12:03:09.111689620 +0000
++++ procps-ng-4.0.4/man/w.1    2023-11-13 12:22:54.245834105 +0000
 @@ -51,6 +51,9 @@ and a
  \fB\-s\fR, \fB\-\-short\fR
  Use the short format.  Don't print the login time, JCPU or PCPU times.
@@ -16,8 +16,8 @@
  Toggle printing the
  .B from
 --- procps-ng-4.0.4/src/w.c
-+++ procps-ng-4.0.4/src/w.c    2023-09-12 12:06:20.612256361 +0000
-@@ -220,7 +220,8 @@ static void print_from(
++++ procps-ng-4.0.4/src/w.c    2023-11-13 12:47:16.843483082 +0000
+@@ -218,7 +218,8 @@ static void print_from(
            if (r < 0 || host == NULL)
                print_host("", 0, fromlen);
            else {
@@ -27,37 +27,44 @@
                free(host);
            }
        } else {
-@@ -513,7 +514,7 @@ static void showinfo(
+@@ -510,7 +511,7 @@ static int find_best_proc(
+ static void showinfo(
              const char *session, const char *name,
- #endif
-             utmp_t * u, int formtype, int maxcmd, int from,
+             utmp_t * u, const int longform, int maxcmd, int from,
 -            const int userlen, const int fromlen, const int ip_addresses,
 +            int userlen, int fromlen, const int ip_addresses,
              const int pids)
  {
      unsigned long long jcpu, pcpu;
-@@ -576,7 +577,19 @@ static void showinfo(
+@@ -520,6 +521,7 @@ static void showinfo(
+     char cmdline[MAX_CMD_WIDTH + 1];
+     pid_t best_pid = -1;
+     int pids_length = 0;
++    int utlnlen = 8;
+ 
+     strcpy(cmdline, "-");
+ 
+@@ -572,7 +574,18 @@ static void showinfo(
+     /* force NUL term for printf */
      uname[UT_NAMESIZE] = '\0';
  
-     if (formtype) {
--        printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
-+        int utlnlen = 8;
-+        if (formtype > 1) {
-+            userlen = strnlen(uname, UT_NAMESIZE);
-+            if (u) {
-+                fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
-+                utlnlen = strnlen(u->ut_line, UT_LINESIZE);
-+            } else {
-+                fromlen = 0;
-+                utlnlen = strlen (tty+5);
-+            }
-+            maxcmd = MAX_CMD_WIDTH;
+-    printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
++    if (longform > 1) {
++        userlen = strlen(uname);
++        if (u) {
++            fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
++            utlnlen = strnlen(u->ut_line, UT_LINESIZE);
++        } else {
++            fromlen = 0;
++            utlnlen = strlen (tty+5);
 +        }
-+        printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, 
utlnlen, tty+5);
- #if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && 
defined(HAVE_SD_SESSION_GET_LEADER)
-         if (session) {
-             uint64_t ltime;
-@@ -658,6 +671,7 @@ static void __attribute__ ((__noreturn__
++        maxcmd = MAX_CMD_WIDTH;
++    }
++    printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, 
tty+5);
+     if (from)
+         print_from(session, NULL, ip_addresses, fromlen);
+ 
+@@ -643,6 +656,7 @@ static void __attribute__ ((__noreturn__
        fputs(_(" -h, --no-header     do not print header\n"),out);
        fputs(_(" -u, --no-current    ignore current process username\n"),out);
        fputs(_(" -s, --short         short format\n"),out);
@@ -65,7 +72,7 @@
        fputs(_(" -f, --from          show remote hostname field\n"),out);
        fputs(_(" -o, --old-style     old style output\n"),out);
        fputs(_(" -i, --ip-addr       display IP address instead of hostname 
(if possible)\n"), out);
-@@ -696,6 +710,7 @@ int main(int argc, char **argv)
+@@ -681,6 +695,7 @@ int main(int argc, char **argv)
                {"no-header", no_argument, NULL, 'h'},
                {"no-current", no_argument, NULL, 'u'},
                {"short", no_argument, NULL, 's'},
@@ -73,7 +80,7 @@
                {"from", no_argument, NULL, 'f'},
                {"old-style", no_argument, NULL, 'o'},
                {"ip-addr", no_argument, NULL, 'i'},
-@@ -718,7 +733,7 @@ int main(int argc, char **argv)
+@@ -703,7 +718,7 @@ int main(int argc, char **argv)
  #endif
  
        while ((ch =
@@ -82,7 +89,7 @@
                switch (ch) {
                case 'h':
                        header = 0;
-@@ -726,6 +741,10 @@ int main(int argc, char **argv)
+@@ -711,6 +726,10 @@ int main(int argc, char **argv)
                case 's':
                        longform = 0;
                        break;

Reply via email to