[PATCH] killdaemons: prevent killing all user processes by bad pid file
Augie Fackler
raf at durin42.com
Thu Aug 18 13:14:45 EDT 2016
On Thu, Aug 18, 2016 at 07:07:53PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1471513428 -32400
> # Thu Aug 18 18:43:48 2016 +0900
> # Node ID 1650ada9f2a157ef12c5177ae360eb6398244d02
> # Parent 8d226db31f20b8c4a2c119e10be7533948f0bad6
> killdaemons: prevent killing all user processes by bad pid file
wow, gpg-connect-agent for the lose. queued.
>
> When I was fixing the test-gpg issue, I noticed gpg-connect-agent could print
> "-1" as a server pid if command was wrong. I'm not pretty sure but nobody
> would want to kill their running applications by mistake.
>
> diff --git a/tests/killdaemons.py b/tests/killdaemons.py
> --- a/tests/killdaemons.py
> +++ b/tests/killdaemons.py
> @@ -82,7 +82,11 @@ def killdaemons(pidfile, tryhard=True, r
> for line in fp:
> try:
> pid = int(line)
> + if pid <= 0:
> + raise ValueError
> except ValueError:
> + logfn('# Not killing daemon process %s - invalid pid'
> + % line.rstrip())
> continue
> kill(pid, logfn, tryhard)
> fp.close()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list