[Pkg-nagios-changes] [pkg-check-mk] 01/01: upstream will now use coreutils timeout if available rather than waitmax

Matt Taggart taggart at moszumanska.debian.org
Thu Dec 22 03:05:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

taggart pushed a commit to branch master
in repository pkg-check-mk.

commit 8a7000930a6907a4289ac58f3ad473667d31f7de
Author: Matt Taggart <taggart at debian.org>
Date:   Wed Dec 21 18:24:38 2016 -0800

    upstream will now use coreutils timeout if available rather than waitmax
---
 debian/check-mk-agent.install  |   1 -
 debian/check-mk-agent.manpages |   1 -
 debian/rules                   |   7 +-
 debian/waitmax.1               |  24 -------
 debian/waitmax.c               | 157 -----------------------------------------
 5 files changed, 2 insertions(+), 188 deletions(-)

diff --git a/debian/check-mk-agent.install b/debian/check-mk-agent.install
index 8d2fdaa..d20975f 100644
--- a/debian/check-mk-agent.install
+++ b/debian/check-mk-agent.install
@@ -1,2 +1 @@
-usr/share/check_mk/agents/waitmax usr/bin
 usr/share/check_mk/agents/mk-job usr/bin
diff --git a/debian/check-mk-agent.manpages b/debian/check-mk-agent.manpages
deleted file mode 100644
index 614ef85..0000000
--- a/debian/check-mk-agent.manpages
+++ /dev/null
@@ -1 +0,0 @@
-debian/waitmax.1
diff --git a/debian/rules b/debian/rules
index 4fe9ed3..ea55979 100755
--- a/debian/rules
+++ b/debian/rules
@@ -72,13 +72,10 @@ install: build
 	rm -rf debian/tmp/usr/share/doc/check_mk/treasures/fsc-celsius*
 	# agent_modbus
 	rm debian/tmp/usr/share/doc/check_mk/treasures/modbus/agent_modbus
-	# waitmax, build our own
+	# remove waitmax binary, check_mk will use timeout if available
 	rm debian/tmp/usr/share/check_mk/agents/waitmax
-	# upstream stopped including waitmax.c, so we carry it in debian/
-	gcc -s -o debian/tmp/usr/share/check_mk/agents/waitmax debian/waitmax.c
-	cp -a livestatus.src/debian/tmp/* debian/tmp/
-	# z_os waitmax
 	rm debian/tmp/usr/share/check_mk/agents/z_os/waitmax
+	cp -a livestatus.src/debian/tmp/* debian/tmp/
 	## config files
 	# We need 2 different "defaults" files for Icinga and Nagios3
 	rm debian/tmp/usr/share/check_mk/modules/defaults
diff --git a/debian/waitmax.1 b/debian/waitmax.1
deleted file mode 100644
index 1a54320..0000000
--- a/debian/waitmax.1
+++ /dev/null
@@ -1,24 +0,0 @@
-.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.39.4.
-.TH WAITMAX "1" "May 2011" "waitmax version 1.1" "User Commands"
-.SH NAME
-waitmax \- manual page for waitmax version 1.1
-.SH SYNOPSIS
-.B waitmax
-[\fI-s SIGNUM\fR] \fIMAXTIME PROGRAM \fR[\fIARGS\fR...]
-.SH DESCRIPTION
-Execute PROGRAM as a subprocess. If PROGRAM does not exit before MAXTIME
-seconds, it will be killed with SIGTERM or an alternative signal.
-.TP
-\fB\-s\fR, \fB\-\-signal\fR SIGNUM
-kill with SIGNUM on timeout
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-this help
-.TP
-\fB\-V\fR, \fB\-\-version\fR
-show version an exit
-.SH COPYRIGHT
-Copyright Mathias Kettner 2008
-.br
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/debian/waitmax.c b/debian/waitmax.c
deleted file mode 100644
index de09216..0000000
--- a/debian/waitmax.c
+++ /dev/null
@@ -1,157 +0,0 @@
-// +------------------------------------------------------------------+
-// |             ____ _               _        __  __ _  __           |
-// |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
-// |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
-// |           | |___| | | |  __/ (__|   <    | |  | | . \            |
-// |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
-// |                                                                  |
-// | Copyright Mathias Kettner 2014             mk at mathias-kettner.de |
-// +------------------------------------------------------------------+
-//
-// This file is part of Check_MK.
-// The official homepage is at http://mathias-kettner.de/check_mk.
-//
-// check_mk is free software;  you can redistribute it and/or modify it
-// under the  terms of the  GNU General Public License  as published by
-// the Free Software Foundation in version 2.  check_mk is  distributed
-// in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
-// out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
-// PARTICULAR PURPOSE. See the  GNU General Public License for more de-
-// ails.  You should have  received  a copy of the  GNU  General Public
-// License along with GNU Make; see the file  COPYING.  If  not,  write
-// to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
-// Boston, MA 02110-1301 USA.
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <getopt.h>
-
-/* macros for using write(2) instead of fprintf(stderr, ) */
-#define out(text) write(2, text, strlen(text));
-
-int g_pid;
-int g_timeout = 0;
-int g_signum = 15;
-
-struct option long_options[] = {
-  { "version"          , no_argument,       0, 'V' },
-  { "help"             , no_argument,       0, 'h' },
-  { "signal"           , required_argument, 0, 's' },
-  { 0, 0, 0, 0 } };
-
-void version()
-{
-  out("waitmax version 1.1\n"
-      "Copyright Mathias Kettner 2008\n"
-      "This is free software; see the source for copying conditions.  There is NO\n"
-      "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
-  exit(0);
-}
-
-
-void usage()
-{
-  out("Usage: waitmax [-s SIGNUM] MAXTIME PROGRAM [ARGS...]\n"
-      "\n"
-      "Execute PROGRAM as a subprocess. If PROGRAM does not exit before MAXTIME\n"
-      "seconds, it will be killed with SIGTERM or an alternative signal.\n"
-      "\n"
-      "   -s, --signal SIGNUM   kill with SIGNUM on timeout\n"
-      "   -h, --help            this help\n"
-      "   -V, --version         show version an exit\n\n");
-  exit(1);
-}
-
-
-void signalhandler(int signum)
-{
-  if (0 == kill(g_pid, g_signum))
-    g_timeout = 1;
-}
-
-
-int main(int argc, char **argv)
-{
-  int indexptr=0;
-  int ret;
-  setenv("POSIXLY_CORRECT", "true", 0);
-  while (0 <= (ret = getopt_long(argc, argv, "Vhs:", long_options, &indexptr))) {
-    switch (ret)
-      {
-      case 'V':
-	version();
-
-      case 'h':
-	usage();
-
-      case 's':
-	g_signum = strtoul(optarg, 0, 10);
-	if (g_signum < 1 || g_signum > 32) {
-	  out("Signalnumber must be between 1 and 32.\n");
-	  exit(1);
-	}
-	break;
-
-      default:
-	usage(argv[0]);
-	exit(1);
-	break;
-      }
-  }
-
-  if (optind + 1 >= argc) usage();
-
-  int maxtime = atoi(argv[optind]);
-  if (maxtime <= 0) usage();
-
-  g_pid = fork();
-  if (g_pid == 0) {
-    signal(SIGALRM, signalhandler);
-    execvp(argv[optind + 1], argv + optind + 1);
-    out("Cannot execute ");
-    out(argv[optind + 1]);
-    out(": ");
-    out(strerror(errno));
-    out("\n");
-    exit(253);
-  }
-
-  signal(SIGALRM, signalhandler);
-  alarm(maxtime);
-  int status;
-  while (1) {
-      int pid = waitpid(g_pid, &status, 0);
-      if (pid <= 0) {
-        if (errno == EINTR) continue; // interuppted by alarm
-      else
-        out("Strange: waitpid() fails: ");
-	out(strerror(errno));
-	out("\n");
-        exit(1);
-      }
-      else break;
-  }
-
-  if (WIFEXITED(status)) {
-    int exitcode = WEXITSTATUS(status);
-    return exitcode;
-  }
-  else if (WIFSIGNALED(status)) {
-    int signum = WTERMSIG(status);
-    if (g_timeout)
-      return 255;
-    else
-      return 128 + signum;
-  }
-  else {
-    out("Strange: program did neither exit nor was signalled.\n");
-    return 254;
-  }
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-check-mk.git



More information about the Pkg-nagios-changes mailing list