From c6e95d22d77f480804ddb5c505891206b427dfb1 Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Mon, 7 May 2012 06:09:37 -0400 Subject: [PATCH] revert "%s" addition in em_main.c, broke %D in log_file. Also added gdb support. This leaves us with a printf warning. We accept that as the cost of using PRINTF_FORMAT for strings that aren't libc formats. --- doc/doc-docbook/spec.xfpt | 6 ++++++ doc/doc-txt/ChangeLog | 3 +++ src/OS/eximon.conf-Default | 2 +- src/exim_monitor/em_main.c | 4 +++- src/src/eximon.src | 17 +++++++++++++++-- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index c4739a80f..0555672dd 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -34371,6 +34371,12 @@ End In order to see the contents of messages on the queue, and to operate on them, &'eximon'& must either be run as root or by an admin user. +The command-line parameters of &'eximon'& are passed to &_eximon.bin_& and may +contain X11 resource parameters interpreted by the X11 library. In addition, +if the first parameter starts with the string "gdb" then it is removed and the +binary is invoked under gdb (the parameter is used as the gdb command-name, so +versioned variants of gdb can be invoked). + The monitor's window is divided into three parts. The first contains one or more stripcharts and two action buttons, the second contains a &"tail"& of the main log file, and the third is a display of the queue of messages awaiting diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index ed226b756..e953f9b53 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -86,6 +86,9 @@ PP/19 DNS resolver init changes for NetBSD compatibility. (Risk of breakage Not seeing resolver debug output on NetBSD, but suspect this is a resolver implementation change. +PP/20 Revert part of NM/04, it broke log_path containing %D expansions. + Left warnings. Added "eximon gdb" invocation mode. + Exim version 4.77 ----------------- diff --git a/src/OS/eximon.conf-Default b/src/OS/eximon.conf-Default index 9e0769831..2f874ef53 100644 --- a/src/OS/eximon.conf-Default +++ b/src/OS/eximon.conf-Default @@ -5,7 +5,7 @@ # The name of the eximon binary, usually the same as the eximon script, # with .bin stuck on the end. -EXIMON_BINARY=${EXIMON_BINARY-$0.bin} +EXIMON_BINARY="${EXIMON_BINARY-$0.bin}" # The remaining parameters are values likely to be changed to suit the # user's taste. They are documented in the EDITME file. diff --git a/src/exim_monitor/em_main.c b/src/exim_monitor/em_main.c index 7193640a5..a0b94b168 100644 --- a/src/exim_monitor/em_main.c +++ b/src/exim_monitor/em_main.c @@ -654,7 +654,9 @@ today.) */ if (log_file[0] != 0) { - (void)string_format(log_file_open, sizeof(log_file_open), "%s", CS log_file); + /* Do *not* use "%s" here, we need the %D datestamp in the log_file to + be expanded! */ + (void)string_format(log_file_open, sizeof(log_file_open), CS log_file); log_datestamping = string_datestamp_offset >= 0; LOG = fopen(CS log_file_open, "r"); diff --git a/src/src/eximon.src b/src/src/eximon.src index d8b3b3182..2211c58a6 100644 --- a/src/src/eximon.src +++ b/src/src/eximon.src @@ -19,6 +19,14 @@ # PROCESSED_FLAG +# See if caller wants to invoke gdb + +use_gdb='' + +case ${1:-foo} in + gdb*) use_gdb="$1"; shift ;; +esac + # Save arguments (can be the usual X parameters) cmd_args="$@" @@ -181,8 +189,13 @@ export EXIM_PATH LD_LIBRARY_PATH \ # Exec to the program we really want to run, thereby continuing in # just the one process, and let it run in parallel with whatever -# called this script. +# called this script (unless gdb was requested in original $1). -exec ${EXIMON_BINARY} $cmd_args & +if [ "${use_gdb:-}" = "" ] ; then + exec "${EXIMON_BINARY}" $cmd_args & +else + exec "$use_gdb" "${EXIMON_BINARY}" $cmd_args + # not backgrounded +fi # End -- 2.30.2