Package: dpkg
Version: 1.17.13
Severity: normal
Tags: patch

start-stop-daemon --stop fails with "no match option" even if --pid or
--ppid is given:

/sbin/start-stop-daemon --stop --pid 66666 --retry "QUIT/5"
/sbin/start-stop-daemon: internal error, no match option, please report

pid and ppid are proper matching options, so they should enough for
start-stop-daemon, the following patch addresses the issue.

This is probably because pid/ppid options were added later and the
relevant commits were not handling the case.

>From 7a9eeca730177a5cac02fe3f62964b39bbe57b40 Mon Sep 17 00:00:00 2001
From: Christos Trochalakis <yati...@ideopolis.gr>
Date: Thu, 2 Oct 2014 15:49:20 +0300
Subject: [PATCH] start-stop-daemon: Don't abort on stop when only pid or ppid
 options are specified

When running with `--stop` and only pid or ppid as matching
options, start-stop-daemon aborts with a "no match option" error.

`pid` and `ppid` are proper matching options, so they should enough to
proceed.
---
 utils/start-stop-daemon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 93850e3..d29712c 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1989,6 +1989,10 @@ run_stop_schedule(void)
 		set_what_stop(execname);
 	else if (pidfile)
 		sprintf(what_stop, "process in pidfile '%.200s'", pidfile);
+	else if (match_pid > 0)
+		sprintf(what_stop, "process with pid '%d'", match_pid);
+	else if (match_ppid > 0)
+		sprintf(what_stop, "process(es) with parent pid '%d'", match_ppid);
 	else if (userspec)
 		sprintf(what_stop, "process(es) owned by '%.200s'", userspec);
 	else
-- 
2.1.1

Reply via email to