From: Dmitry Chistikov <dd1email@gmail.com>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] Убивание процесса со всеми его дочками
Date: Tue, 31 Jan 2012 12:52:03 +0400
Message-ID: <20120131085203.GA8963@conflux.foliandre> (raw)
In-Reply-To: <4F279FA3.1040607@mail.ru>
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
Vladimir Karpinsky, Jan. 31, 2012, 12:00 +0400:
> Но! для 4.0 --- pkill (procps version 3.2.5):
> $ ps -eHo pid,pgid,cmd | grep 27319
> 27319 27319 /bin/bash /home/karp/bin/get_data
> 27340 27319 ping 5.86.210.67 -q -c5 -w10
>
> $ pkill -g 27319
> pkill: No matching criteria specified
> Usage: pkill [-SIGNAL] [-fvx] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
> [-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
Насколько я вижу, это бага в procps.
Сравните:
3.2.5-alt7: http://git.altlinux.org/gears/p/procps.git?p=procps.git;a=blob;f=procps/pgrep.c;h=cf6ced95464864957fe98be998dad67149059ecb;hb=fe6442d4ad66cb30e095e743b94c448f7d5b2857#l538
3.2.8-alt1: http://git.altlinux.org/gears/p/procps.git?p=procps.git;a=blob;f=procps/pgrep.c;h=7ab63ea6d8c7b23e7a298b45cdab8d5dc1a5e6d5;hb=5268d4e01a739a6c48fe180d7c98b17172340d7a#l626
В старой версии -g не учитывается в подсчете критериев выбора,
в результате чего pkill полагает, что таковых не указано.
Согласно
http://git.altlinux.org/gears/p/procps.git?p=procps.git;a=history;f=procps/pgrep.c
и
http://git.altlinux.org/gears/p/procps.git?p=procps.git;a=commitdiff;h=76b8c1dcd63ad56be6a8dccf3f506fea44acd5ab ,
исправление появилось где-то между v3.2.5 и v3.2.7 (точнее, между
procps-3.2.6 и procps-3.2.7; см., например, "pgrep/pkill: g is criteria
(PLD Linux, patch found in locked filing cabinet)" в NEWS).
Если я правильно представляю Вашу задачу, то в качестве обхода можно
задать дополнительно что-нибудь вроде -U username.
Альтернатива: прикладываю патч, который должен решать эту проблему.
--
Дмитрий Чистиков
[-- Attachment #2: procps-3.2.5-alt-pgrep-pgid.patch --]
[-- Type: text/plain, Size: 366 bytes --]
diff --git a/procps/pgrep.c b/procps/pgrep.c
index cf6ced9..2fe5986 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -538,8 +538,9 @@ parse_opts (int argc, char **argv)
case 'g':
opt_pgrp = split_list (optarg, conv_pgrp);
if (opt_pgrp == NULL)
usage (opt);
+ ++criteria_count;
break;
// case 'i':
// opt_insensitive = 1;
// break;
next prev parent reply other threads:[~2012-01-31 8:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 15:50 Vladimir Karpinsky
2012-01-30 17:26 ` Anton Protopopov
2012-01-30 18:01 ` Vladimir Karpinsky
2012-01-30 18:23 ` Dmitry Chistikov
2012-01-30 18:36 ` Vladimir Karpinsky
2012-01-30 19:05 ` Dmitry Chistikov
2012-01-30 19:22 ` Vladimir Karpinsky
2012-01-30 20:34 ` Dmitry Chistikov
2012-01-31 8:00 ` Vladimir Karpinsky
2012-01-31 8:52 ` Dmitry Chistikov [this message]
2012-01-31 9:44 ` Vladimir Karpinsky
2012-01-31 10:00 ` Vladimir Karpinsky
2012-01-31 10:27 ` Dmitry Chistikov
2012-01-31 10:58 ` Vladimir Karpinsky
2012-01-31 11:18 ` Dmitry Chistikov
2012-01-30 17:31 ` Vladimir Karpinsky
2012-01-30 17:35 ` Dmitry Chistikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120131085203.GA8963@conflux.foliandre \
--to=dd1email@gmail.com \
--cc=community@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git