pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/psmisc



Module Name:    pkgsrc
Committed By:   mcf
Date:           Tue Oct  6 00:19:05 UTC 2020

Modified Files:
        pkgsrc/sysutils/psmisc: Makefile distinfo
        pkgsrc/sysutils/psmisc/patches: patch-af

Log Message:
psmisc: fix sscanf usage bug under musl libc

C99 says that the %15c conversion specifier matches *exactly* 15
characters, so if the process name is shorter than 15 characters,
it is not matched and 0 is returned. Some implementations (such as
glibc) return a match, even with fewer characters than the field
width, but this cannot be assumed.

Instead, use %15[^)], as in upstream commit [0], which matches a
non-empty sequence of characters other than ')'.

[0] https://gitlab.com/psmisc/psmisc/-/commit/ca2b176889729a7347bd95b832b9a5bb39fec229


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 pkgsrc/sysutils/psmisc/Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/sysutils/psmisc/distinfo
cvs rdiff -u -r1.6 -r1.7 pkgsrc/sysutils/psmisc/patches/patch-af

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/psmisc/Makefile
diff -u pkgsrc/sysutils/psmisc/Makefile:1.32 pkgsrc/sysutils/psmisc/Makefile:1.33
--- pkgsrc/sysutils/psmisc/Makefile:1.32        Fri Mar 20 11:58:22 2020
+++ pkgsrc/sysutils/psmisc/Makefile     Tue Oct  6 00:19:05 2020
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.32 2020/03/20 11:58:22 nia Exp $
+# $NetBSD: Makefile,v 1.33 2020/10/06 00:19:05 mcf Exp $
 
 DISTNAME=              psmisc-20.1
 CATEGORIES=            sysutils
-PKGREVISION=           3
+PKGREVISION=           4
 MASTER_SITES=          ${MASTER_SITE_SOURCEFORGE:=psmisc/}
 
 MAINTAINER=            pkgsrc-users%NetBSD.org@localhost

Index: pkgsrc/sysutils/psmisc/distinfo
diff -u pkgsrc/sysutils/psmisc/distinfo:1.8 pkgsrc/sysutils/psmisc/distinfo:1.9
--- pkgsrc/sysutils/psmisc/distinfo:1.8 Wed Nov  4 01:32:26 2015
+++ pkgsrc/sysutils/psmisc/distinfo     Tue Oct  6 00:19:05 2020
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2015/11/04 01:32:26 agc Exp $
+$NetBSD: distinfo,v 1.9 2020/10/06 00:19:05 mcf Exp $
 
 SHA1 (psmisc-20.1.tar.gz) = e969a2f539b181c372b0f82bbbd430c4d57d5d6b
 RMD160 (psmisc-20.1.tar.gz) = 48698ad9f431c881bcb42394f5c912ef91b84d2b
@@ -8,5 +8,5 @@ SHA1 (patch-ab) = 74134f6cd2ea0270fdbaff
 SHA1 (patch-ac) = 9f9a7c7c5155345a1045aee70a2dd65a25ec7219
 SHA1 (patch-ad) = 6e2886ca59160d161d334e276675f187f138db7c
 SHA1 (patch-ae) = 484305118582c575f8c4827783aa3d5f57b25b5d
-SHA1 (patch-af) = c89f887f572cb7bf22ff05fc6b76eca7fcb34337
+SHA1 (patch-af) = ecba31c5e44291e695eb4b9ea19b9a70cdbd3f67
 SHA1 (patch-ag) = a03a4a0c0dbf065e2b2785cee8f23579a11ae13f

Index: pkgsrc/sysutils/psmisc/patches/patch-af
diff -u pkgsrc/sysutils/psmisc/patches/patch-af:1.6 pkgsrc/sysutils/psmisc/patches/patch-af:1.7
--- pkgsrc/sysutils/psmisc/patches/patch-af:1.6 Tue Sep 23 22:18:21 2014
+++ pkgsrc/sysutils/psmisc/patches/patch-af     Tue Oct  6 00:19:05 2020
@@ -1,7 +1,10 @@
-$NetBSD: patch-af,v 1.6 2014/09/23 22:18:21 jperkin Exp $
+$NetBSD: patch-af,v 1.7 2020/10/06 00:19:05 mcf Exp $
 
 Need limits.h for PATH_MAX
 
+Fix sscanf usage bug on musl libc and uclibc (upstream commit
+https://gitlab.com/psmisc/psmisc/-/commit/ca2b176889729a7347bd95b832b9a5bb39fec229)
+
 --- src/pstree.c.orig  2000-12-18 05:59:23.000000000 +0000
 +++ src/pstree.c
 @@ -15,19 +15,22 @@
@@ -65,7 +68,7 @@ Need limits.h for PATH_MAX
        if ((file = fopen (path, "r")) != NULL)
          {
            empty = 0;
-@@ -513,6 +519,10 @@ read_proc (void)
+@@ -513,16 +519,19 @@ read_proc (void)
                perror (path);
                exit (1);
              }
@@ -76,7 +79,18 @@ Need limits.h for PATH_MAX
              fread(readbuf, BUFSIZ, 1, file) ;
              if (ferror(file) == 0) 
              {
-@@ -532,11 +542,12 @@ read_proc (void)
+               memset(comm, '\0', COMM_LEN+1);
+               tmpptr = strrchr(readbuf, ')'); /* find last ) */
+-              *tmpptr = '\0';
+               /* We now have readbuf with pid and cmd, and tmpptr+2
+                * with the rest */
+               /*printf("readbuf: %s\n", readbuf);*/
+-              if (sscanf(readbuf, "%*d (%15c", comm) == 1)
++              if (sscanf(readbuf, "%*d (%15[^)]", comm) == 1)
+               {
+                 /*printf("tmpptr: %s\n", tmpptr+2);*/
+                 if (sscanf(tmpptr+2, "%*c %d", &ppid) == 1)
+@@ -532,11 +541,12 @@ read_proc (void)
                (file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy,
                 &ppid) == 4)
              */
@@ -90,7 +104,7 @@ Need limits.h for PATH_MAX
                    if ((fd = open (path, O_RDONLY)) < 0)
                      {
                        perror (path);
-@@ -641,7 +652,11 @@ main (int argc, char **argv)
+@@ -641,7 +651,11 @@ main (int argc, char **argv)
      switch (c)
        {
        case 'a':



Home | Main Index | Thread Index | Old Index