Bug#992243: buster-pu: package psmisc/23.2-1+deb10u1

2021-09-04 Thread Craig Small
Thanks for looking after this Raphael! This will stop a lot a bug reports
about why does the process not get found.

 - Craig


On Sun, 5 Sep 2021, 01:01 Raphael Hertzog,  wrote:

> Hello,
>
> On Sat, 04 Sep 2021, Adam D. Barratt wrote:
> > On Mon, 2021-08-16 at 12:02 +0200, Raphael Hertzog wrote:
> > > I would like to update "psmisc" in buster to fix a regression in
> > > "killall". The bug https://bugs.debian.org/912748 was never fixed in
> > > that release and "killall command-longer-than-15-char" is thus not
> > > working at all in buster
> >
> > Please go ahead.
>
> Thanks, uploaded.
>
> Cheers,
> --
> Raphaël Hertzog ◈ Freexian SARL ◈ Tel: +33 (0)6 88 21 35 47
> https://www.freexian.com
>


Bug#992243: buster-pu: package psmisc/23.2-1+deb10u1

2021-09-04 Thread Raphael Hertzog
Hello,

On Sat, 04 Sep 2021, Adam D. Barratt wrote:
> On Mon, 2021-08-16 at 12:02 +0200, Raphael Hertzog wrote:
> > I would like to update "psmisc" in buster to fix a regression in
> > "killall". The bug https://bugs.debian.org/912748 was never fixed in
> > that release and "killall command-longer-than-15-char" is thus not
> > working at all in buster
> 
> Please go ahead.

Thanks, uploaded.

Cheers,
-- 
Raphaël Hertzog ◈ Freexian SARL ◈ Tel: +33 (0)6 88 21 35 47
https://www.freexian.com



Bug#992243: buster-pu: package psmisc/23.2-1+deb10u1

2021-09-04 Thread Adam D. Barratt
Control: tags -1 + confirmed

On Mon, 2021-08-16 at 12:02 +0200, Raphael Hertzog wrote:
> I would like to update "psmisc" in buster to fix a regression in
> "killall". The bug https://bugs.debian.org/912748 was never fixed in
> that release and "killall command-longer-than-15-char" is thus not
> working at all in buster
> 

Please go ahead.

Regards,

Adam



Bug#992243: buster-pu: package psmisc/23.2-1+deb10u1

2021-08-16 Thread Raphael Hertzog
Package: release.debian.org
Severity: normal
Tags: buster
User: release.debian@packages.debian.org
Usertags: pu
X-Debbugs-Cc: raph...@freexian.com csm...@debian.org

Hello,

I would like to update "psmisc" in buster to fix a regression in
"killall". The bug https://bugs.debian.org/912748 was never fixed in that
release and "killall command-longer-than-15-char" is thus not working at
all in buster

It seems to me to fall in the "important regression" that ought to be
fixed by a point release and I'm surprised that nobody hit this earlier.

This was reported to me by a Freexian customer that did not understand why
his script was no longer working with Debian 10.

The upstream patch that I backported is in use in bullseye and newer
(though there might be further upstream changes on top since we are at
23.4 now). I have tested the resulting package and it now successfully
kills processes with long command names.

Craig, I have pushed this upload in a "buster" branch on salsa. Your
review is welcome.

https://salsa.debian.org/debian/psmisc/-/tree/buster
https://salsa.debian.org/debian/psmisc/-/commit/e34a294a95895f5ef7e9f8d532dd5e0ba2a0f372

Cheers,
-- 
Raphaël Hertzog
>From e34a294a95895f5ef7e9f8d532dd5e0ba2a0f372 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= 
Date: Mon, 16 Aug 2021 11:07:34 +0200
Subject: [PATCH] Backport upstream patch to also match on 16 char
 TASK_COMM_LEN

At some point before the buster release, killall changed its COMM_LEN to
64 to cope with an (expected?) similar change in the kernel. But this
change is not present in buster's kernel and in fact, in none of the
other newer kernels AFAIK (likely due to the kernel "no-user-space
breakage" rule). And due to this mismatch, killall is not able to
identify process with names bigger than 15 characters.

Newer versions of killall thus learned to handle both possible lenghts
and this commit just backports the corresponding patch to fix this
regression in Debian 10.
---
 debian/changelog|   9 ++
 debian/patches/match-on-16-char-commlen | 122 
 debian/patches/series   |   1 +
 3 files changed, 132 insertions(+)
 create mode 100644 debian/patches/match-on-16-char-commlen

diff --git a/debian/changelog b/debian/changelog
index 734542f..02b57c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+psmisc (23.2-1+deb10u1) buster; urgency=medium
+
+  * Team upload.
+  * Fix regression in killall not matching process with names bigger than 15
+characters by backporting the upstream patch that restores the check
+that works on kernels that have TASK_COMM_LEN set to 16. Closes: #912748
+
+ -- Raphaël Hertzog   Mon, 16 Aug 2021 11:17:53 +0200
+
 psmisc (23.2-1) unstable; urgency=medium
 
   * New upstream release
diff --git a/debian/patches/match-on-16-char-commlen b/debian/patches/match-on-16-char-commlen
new file mode 100644
index 000..5037bd0
--- /dev/null
+++ b/debian/patches/match-on-16-char-commlen
@@ -0,0 +1,122 @@
+From 1188315cd037d73bf946a0003b70c6423cc330d2 Mon Sep 17 00:00:00 2001
+From: Craig Small 
+Date: Wed, 7 Nov 2018 20:13:09 +1100
+Subject: [PATCH] killall: match on 16 character commlen too
+
+The comm length increase meant killall could accommodate the
+larger comm name given out by newer kernels but it meant that
+if a user relied on the previous 16 character truncation then
+processes that used to match would fail.
+
+killall now checks to see if the comm is the old COMM_LEN
+length and the given name is longer than old COMM_LEN and does
+a truncated match as well.
+
+Bug-Debian: https://bugs.debian.org/912748
+Origin: upstream, https://gitlab.com/psmisc/psmisc/-/commit/1188315cd037d73bf946a0003b70c6423cc330d2 https://gitlab.com/psmisc/psmisc/-/commit/e2cf9f3e83e0fc0278ff39a4dfc8e3f2730eebca
+---
+diff --git a/src/killall.c b/src/killall.c
+index 2715515..09212a4 100644
+--- a/src/killall.c
 b/src/killall.c
+@@ -492,6 +492,49 @@ create_pid_table(int *max_pids, int *pids)
+ return pid_table;
+ }
+ 
++#define strcmp2(A,B,I) (I? strcasecmp((A),(B)):strcmp((A),(B)))
++#define strncmp2(A,B,L,I) (I? strncasecmp((A),(B),(L)):strncmp((A),(B),(L)))
++static int match_process_name(
++const char *proc_comm,
++const int comm_len,
++const char *proc_cmdline,
++const char *match_name,
++const int match_len,
++const int got_long
++ )
++{
++/* process is old length but matching longer */
++if (comm_len == OLD_COMM_LEN - 1 && match_len >= OLD_COMM_LEN - 1)
++{
++if (got_long)
++{
++return (0 == strncmp2 (match_name, proc_cmdline, OLD_COMM_LEN - 1,
++   ignore_case));
++} else {
++return (0 == strncmp2 (match_name, proc_comm, OLD_COMM_LEN - 1,
++   ignore_case));
++}
++}
++
++if (comm_len == COMM_LEN - 1 && match_len >= COMM_LEN - 1)
++{