Created attachment 238465 [details] Patchfile Hello, the current version of killall(1) does not allow sending signals to processes attached to a pts(4) e.g /dev/pts/4 and to do so results in an error messages like the one below. #killall -t pts/4 killall: stat(/dev/ttypts/4): No such file or directory The provided patch would enable the ability to do that. Best regards Daniel Dowse --- killall.c.orig 2022-12-01 02:47:39.299477000 +0100 +++ killall.c 2022-12-01 02:47:21.503069000 +0100 @@ -257,6 +257,8 @@ snprintf(buf, sizeof(buf), "%s", tty); else if (strncmp(tty, "tty", 3) == 0) snprintf(buf, sizeof(buf), "/dev/%s", tty); + else if (strncmp(tty, "pts", 3) == 0) + snprintf(buf, sizeof(buf), "/dev/%s", tty); else snprintf(buf, sizeof(buf), "/dev/tty%s", tty); if (stat(buf, &sb) < 0)
It is better to match on pts/, not just pts. For tty, the short match allows to specify e.g. ttyuX, i.e. USB-serial ports. Also, there is no need to have two identical snprintfs. Below is what I intent to commit after your confirmation. commit e442917ee41986c416afea1d152ad03c5daeeac4 Author: Daniel Dowse <freebsd-bugs@daemonbytes.net> Date: Thu Dec 1 04:42:35 2022 +0200 killall(1): allow sending signals to processes with control terminal on pts(4) PR: 268093 Reviewed by: kib MFC after: 1 week diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index aca0830c158b..494a527d190b 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -255,7 +255,8 @@ main(int ac, char **av) if (tty) { if (strncmp(tty, "/dev/", 5) == 0) snprintf(buf, sizeof(buf), "%s", tty); - else if (strncmp(tty, "tty", 3) == 0) + else if (strncmp(tty, "tty", 3) == 0 || + strncmp(tty, "pts/", 4) == 0) snprintf(buf, sizeof(buf), "/dev/%s", tty); else snprintf(buf, sizeof(buf), "/dev/tty%s", tty);
Hello Konstantin, thanks you are right. I confirm. Best regards Daniel
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e442917ee41986c416afea1d152ad03c5daeeac4 commit e442917ee41986c416afea1d152ad03c5daeeac4 Author: Daniel Dowse <freebsd-bugs@daemonbytes.net> AuthorDate: 2022-12-01 02:42:35 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-01 02:42:35 +0000 killall(1): allow sending signals to processes with control terminal on pts(4) PR: 268093 Reviewed by: kib MFC after: 1 week usr.bin/killall/killall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Thanks. Triage: [patch] is amongst the summary line tags that are deprecated. MFC to both stable/13 and stable/12, or just 13?
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a76fa7bb6cb721bcccc257ddbc4398d25dc8def8 commit a76fa7bb6cb721bcccc257ddbc4398d25dc8def8 Author: Daniel Dowse <freebsd-bugs@daemonbytes.net> AuthorDate: 2022-12-01 02:42:35 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-08 01:18:32 +0000 killall(1): allow sending signals to processes with control terminal on pts(4) PR: 268093 (cherry picked from commit e442917ee41986c416afea1d152ad03c5daeeac4) usr.bin/killall/killall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)