Solved pkill kills processes by arguments

even when called without the -f switch. Same for pgrep. 'pkill firefox' kills all python processes that have firefoxin the argument list as part of a path. Why?

... an effect of python called by a shell script with arguments?
... correction: pgrep does not list it, but pkill kills it.

(Reinstalled from source minutes ago
FreeBSD 15.1-STABLE stable/15-n285467-3d961305e170 GENERIC amd64)
 
i can't replicate it
also pkill and pgrep are the same binary
FreeBSD instance-20260827-1504 15.1-RELEASE-p4 FreeBSD 15.1-RELEASE-p4 releng/15.1-n283627-db6066678b33 GENERIC arm64
 
It also 'works' for other arguments of that python command ... and for other running python processes, too. And shprocesses.
The args are not exactly handled the same in /usr/src/bin/pkill/pkill.c
 
$ ls -li /bin/pkill /bin/pgrep
120052 -r-xr-xr-x 2 root wheel 18080 Sep 29 01:59 /bin/pgrep
120052 -r-xr-xr-x 2 root wheel 18080 Sep 29 01:59 /bin/pkill
do you have a mismatched version between kernel and userland ?
 
kills all python processes that have firefoxin the argument list as part of a path. Why?
Is it possible those scripts aren't killed but crash when their connection to firefox is broken because firefox got killed?
 
What's going on here? /bin/pkill is different from /bin/pkill?
Code:
# /bin/pkill -I movi
# pkill -I movi
kill -15 96367]
kill 96367 python3.12? n
# which pkill
/bin/pkill
#  ls -li /bin/pkill /bin/pgrep
561684 -r-xr-xr-x  2 root wheel 17696  1 Okt. 14:41 /bin/pgrep*
561684 -r-xr-xr-x  2 root wheel 17696  1 Okt. 14:41 /bin/pkill*

... it only happens when called from bash, not sh!
 
even when called without the -f switch. Same for pgrep. 'pkill firefox' kills all python processes that have firefoxin the argument list as part of a path. Why?

IIRC pkill/pgrep works with extended regular expressions - you need to anchor the match if you want to avoid a sub-string match on arguments.
 
Back
Top