From: Francis Dupont Date: Fri, 31 May 2019 15:29:29 +0000 (+0200) Subject: [538-kea-should-not-store-anything-in-var-kea-lsb-violation] Introduced runstatedir... X-Git-Tag: Kea-1.6.0-beta2~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85c5b01d694c995f6e93c0454ee6e0031fc75d83;p=thirdparty%2Fkea.git [538-kea-should-not-store-anything-in-var-kea-lsb-violation] Introduced runstatedir for pid files --- diff --git a/configure.ac b/configure.ac index c8c26bbfe3..8557c60d74 100644 --- a/configure.ac +++ b/configure.ac @@ -1527,6 +1527,13 @@ AM_COND_IF([HAVE_OPTRESET], [AC_DEFINE([HAVE_OPTRESET], [1], [Check for optreset AC_DEFINE([CONFIG_H_WAS_INCLUDED], [1], [config.h inclusion marker]) +# Autoconf 2.70 has runstatedir but is not yet released. +if test "x$runstatedir" = "x"; then + AC_ARG_VAR(runstatedir, [$localstatedir/run for autoconf < 2.70]) + runstatedir="$localstatedir/run" + AC_SUBST(runstatedir) +fi + AC_CONFIG_FILES([Makefile compatcheck/Makefile doc/Makefile diff --git a/doc/guide/ddns.xml b/doc/guide/ddns.xml index b96f1881e6..879cac3695 100644 --- a/doc/guide/ddns.xml +++ b/doc/guide/ddns.xml @@ -174,12 +174,12 @@ strings path/kea-dhcp-ddns | sed -n 's/;;;; //p' During startup the server will attempt to create a PID file of the - form: [localstatedir]/[conf name].kea-dhcp-ddns.pid + form: [runstatedir]/[conf name].kea-dhcp-ddns.pid where: - localstatedir: The value as passed into the - build configure script; it defaults to "/usr/local/var". Note + runstatedir: The value as passed into the + build configure script; it defaults to "/usr/local/var/run". Note that this value may be overridden at runtime by setting the environment variable KEA_PIDFILE_DIR. This is intended primarily for testing purposes. diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 9ec5d368ab..83b56a47ac 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -96,11 +96,11 @@ During startup, the server will attempt to create a PID file of the - form: [localstatedir]/[conf name].kea-dhcp4.pid where: + form: [runstatedir]/[conf name].kea-dhcp4.pid where: - localstatedir: The value as passed into the - build configure script; it defaults to "/usr/local/var". Note + runstatedir: The value as passed into the + build configure script; it defaults to "/usr/local/var/run". Note that this value may be overridden at runtime by setting the environment variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes. diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml index c91b122ad3..01c4fd2112 100644 --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@ -96,11 +96,11 @@ During startup, the server will attempt to create a PID file of the - form: localstatedir]/[conf name].kea-dhcp6.pid where: + form: [runstatedir]/[conf name].kea-dhcp6.pid where: - localstatedir: The value as passed into the - build configure script; it defaults to "/usr/local/var". Note + runstatedir: The value as passed into the + build configure script; it defaults to "/usr/local/var/run". Note that this value may be overridden at runtime by setting the environment variable KEA_PIDFILE_DIR, although this is intended primarily for testing purposes. diff --git a/src/bin/keactrl/kea-dhcp4.conf.pre b/src/bin/keactrl/kea-dhcp4.conf.pre index 2252b03924..60d396e242 100644 --- a/src/bin/keactrl/kea-dhcp4.conf.pre +++ b/src/bin/keactrl/kea-dhcp4.conf.pre @@ -252,7 +252,7 @@ // // of all devices serviced by Kea, including their identifiers // // (like MAC address), their location in the network, times // // when they were active etc. - // "library": "@localstatedir@/kea/libdhcp_legal_log.so" + // "library": "@libdir@/kea/hooks/libdhcp_legal_log.so" // "parameters": { // "path": "/var/kea/var", // "base-name": "kea-forensic4" @@ -269,7 +269,7 @@ // // of specific options or perhaps even a combination of several // // options and fields to uniquely identify a client. Those scenarios // // are addressed by the Flexible Identifiers hook application. - // "library": "@localstatedir@/kea/libdhcp_flex_id.so", + // "library": "@libdir@/kea/hooks/libdhcp_flex_id.so", // "parameters": { // "identifier-expression": "substring(relay6[0].option[18],0,8)" // } diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in index 0dd2f29ba8..c5af47a4fd 100644 --- a/src/bin/keactrl/keactrl.in +++ b/src/bin/keactrl/keactrl.in @@ -99,9 +99,9 @@ get_pid_from_file() { local conf_name conf_name=$(basename -- "${kea_config_file}" | cut -f1 -d'.') - # Default the directory to --localstatedir + # Default the directory to --localstatedir / run local pid_file_dir - pid_file_dir=@localstatedir@/@PACKAGE@ + pid_file_dir=@runstatedir@/@PACKAGE@ # Use directory override if set (primarily for testing only) if [ -n "$KEA_PIDFILE_DIR" ]; then @@ -333,7 +333,7 @@ run_conditional() { # to the default file. if [ -z "${KEA_LOGGER_DESTINATION}" ]; then prefix=@prefix@ - export KEA_LOGGER_DESTINATION=@localstatedir@/@PACKAGE@/kea.log + export KEA_LOGGER_DESTINATION=@localstatedir@/log/kea.log fi command=${1} diff --git a/src/lib/process/Makefile.am b/src/lib/process/Makefile.am index b8b58caef5..29b3868032 100644 --- a/src/lib/process/Makefile.am +++ b/src/lib/process/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = . testutils tests -dhcp_data_dir = @localstatedir@/@PACKAGE@ +dhcp_data_dir = @runstatedir@/@PACKAGE@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += -DDATA_DIR="\"$(dhcp_data_dir)\"" diff --git a/src/lib/process/daemon.h b/src/lib/process/daemon.h index 7ef812d952..91a2412dba 100644 --- a/src/lib/process/daemon.h +++ b/src/lib/process/daemon.h @@ -268,7 +268,7 @@ private: std::string proc_name_; /// @brief Pointer to the directory where PID file(s) are written - /// It defaults to --localstatedir + /// It defaults to --localstatedir / run std::string pid_file_dir_; /// @brief Pointer to the PID file for this process diff --git a/src/lib/process/process_messages.mes b/src/lib/process/process_messages.mes index e130e7d53c..6e60b0383a 100644 --- a/src/lib/process/process_messages.mes +++ b/src/lib/process/process_messages.mes @@ -107,9 +107,9 @@ This is an error message that occurs when the server is unable to create its PID file. The log message should contain details sufficient to determine the underlying cause. The most likely culprits are that some portion of the pathname does not exist or a permissions issue. The -default path is determined by --localstatedir configure parameter but -may be overridden by setting environment variable, KEA_PIDFILE_DIR. The -first argument is the process name. +default path is determined by --localstatedir or --runstatedir configure +parameters but may be overridden by setting environment variable, +KEA_PIDFILE_DIR. The first argument is the process name. % DCTL_PROCESS_FAILED %1 application execution failed: %2 The controller has encountered a fatal error while running the diff --git a/src/lib/process/tests/Makefile.am b/src/lib/process/tests/Makefile.am index 253a9c378c..2fb87683e6 100644 --- a/src/lib/process/tests/Makefile.am +++ b/src/lib/process/tests/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = . -dhcp_data_dir = @localstatedir@/@PACKAGE@ +dhcp_data_dir = @runstatedir@/@PACKAGE@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\" diff --git a/src/lib/testutils/dhcp_test_lib.sh.in b/src/lib/testutils/dhcp_test_lib.sh.in index b00fc22058..462522ca7e 100644 --- a/src/lib/testutils/dhcp_test_lib.sh.in +++ b/src/lib/testutils/dhcp_test_lib.sh.in @@ -257,9 +257,9 @@ set_logger() { export KEA_LOGGER_DESTINATION=${LOG_FILE} } -# PID file path is by default /var/kea, but can be +# PID file path is by default /var/run/kea, but can be # overridden by the environmental variable. -PID_FILE_PATH=@localstatedir@/@PACKAGE@/ +PID_FILE_PATH=@runstatedir@/@PACKAGE@/ if [ ! -z ${KEA_PIDFILE_DIR} ]; then PID_FILE_PATH="${KEA_PIDFILE_DIR}" fi