From: Jim Jagielski
Date: Tue, 14 Aug 2012 21:08:35 +0000 (+0000)
Subject: Merge r1364695, r1369477, r1369808, r1370288, r1370225, r1370763, r1371684 from trunk:
X-Git-Tag: 2.4.3~40
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8c5165c28f1c694eee6740f7ac1fa53ca96beed;p=apache
Merge r1364695, r1369477, r1369808, r1370288, r1370225, r1370763, r1371684 from trunk:
mod_lbmethod_heartbeat, mod_heartmonitor: Respect DefaultRuntimeDir/
DEFAULT_REL_RUNTIMEDIR for the heartbeat storage file.
core: Respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR for the
scoreboard (ScoreBoardFile).
The Pidfile directive and ap_log_pid()/ap_remove_pid()/ap_read_pid()
now respect DefaultRuntimeDir
Mutex directive: finish support of DefaultRuntimeDir
a partial conversion was made in r1299718, but I'm not
sure when that change is effective
mod_socache_shmcb and mod_socache_dbm: finish support of
DefaultRuntimeDir
a partial conversion was made in r1299718, affecting cases
where no filename was specified
mod_slotmem_plain: make the "filename" key relative to
DefaultRuntimeDir if not absolute
mod_slotmem_plain does not externalize or check the full path
in any way, so this change is just for consistency with other
modules which build paths to run-time artifacts.
make LDAPSharedCacheFile relative to DefaultRuntimeDir
Submitted by: trawick
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1373105 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/CHANGES b/CHANGES
index 03a7607c3c..15082fcf05 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,8 +10,14 @@ Changes with Apache 2.4.3
*) ab: Fix read failure when targeting SSL server. [Jeff Trawick]
*) The following now respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR:
+ - core: the scoreboard (ScoreBoardFile), pid file (PidFile), and
+ mutexes (Mutex)
- mod_auth_digest: shared memory file
- [Jeff Trawick]
+ - APIs: ap_log_pid(), ap_remove_pid, ap_read_pid()
+ - mod_lbmethod_heartbeat, mod_heartmonitor: heartbeat storage file
+ - mod_ldap: shared memory cache
+ - mod_socache_shmcb, mod_socache_dbm: shared memory or dbm for cache
+ [Jeff Trawick, Jim Jagielski]
*) htpasswd: Use correct file mode for checking if file is writable.
PR 45923. [Stefan Fritsch]
@@ -72,11 +78,6 @@ Changes with Apache 2.4.3
*) Add "strict" and "warnings" pragmas to Perl scripts. [Rich Bowen]
- *) The following now respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR:
- - core: the scoreboard (ScoreBoardFile), pid file (PidFile), and
- mutexes (Mutex)
- [Jim Jagielski]
-
*) ab: Fix bind() errors. [Joe Orton]
*) mpm_event: Don't do a blocking write when starting a lingering close
diff --git a/STATUS b/STATUS
index fcd3c8d0ac..4379ae41b5 100644
--- a/STATUS
+++ b/STATUS
@@ -93,27 +93,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
2.4.x patch: trunk patch works
+1: rjung, humbedooh, trawick (needs CHANGES entry)
- * opinion on more complete DefaultRuntimeDir use in 2.4.x?
- o If a module has a config directive for the run-time file that
- treats the configured path as relative to server root, preserve
- that behavior but change the location when not configured to
- respect DefaultRuntimeDir. With these changes, users with no
- per-runtime-file configuration directives can control
- everything with DefaultRuntimeDir.
- BUT: Existing users of DefaultRuntimeDir might get a short-term scare
- when some unconfigured run-time file starts respecting their
- DefaultRuntimeDir directive after an upgrade.
- +1: trawick, jim, rjung
- rjung: backport candidates are:
- heartbeat r1364695
- scoreboard r1369477
- core/pid file r1369808
- core/mutex r1370288
- mod_socache_XXX r1370225
- mod_slotmem_plain r1370763
- mod_ldap r1371684
-
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
diff --git a/docs/conf/extra/httpd-mpm.conf.in b/docs/conf/extra/httpd-mpm.conf.in
index bf29fafe00..0506d2fc91 100644
--- a/docs/conf/extra/httpd-mpm.conf.in
+++ b/docs/conf/extra/httpd-mpm.conf.in
@@ -9,7 +9,7 @@
# Note that this is the default PidFile for most MPMs.
#
- PidFile "@rel_runtimedir@/httpd.pid"
+ PidFile "httpd.pid"
#
diff --git a/docs/conf/extra/httpd-ssl.conf.in b/docs/conf/extra/httpd-ssl.conf.in
index 673d1aa816..33db96d2fe 100644
--- a/docs/conf/extra/httpd-ssl.conf.in
+++ b/docs/conf/extra/httpd-ssl.conf.in
@@ -72,8 +72,8 @@ SSLPassPhraseDialog builtin
# Inter-Process Session Cache:
# Configure the SSL Session Cache: First the mechanism
# to use and second the expiring timeout (in seconds).
-#SSLSessionCache "dbm:@exp_runtimedir@/ssl_scache"
-SSLSessionCache "shmcb:@exp_runtimedir@/ssl_scache(512000)"
+#SSLSessionCache "dbm:ssl_scache"
+SSLSessionCache "shmcb:ssl_scache(512000)"
SSLSessionCacheTimeout 300
##
diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml
index 5d69de1742..e4dd46763f 100644
--- a/docs/manual/mod/core.xml
+++ b/docs/manual/mod/core.xml
@@ -3142,9 +3142,11 @@ or specified mutexes
With the file-based mechanisms fcntl and flock,
the path, if provided, is a directory where the lock file will be created.
- The default directory is httpd's run-time file directory relative to
- ServerRoot. Always use a local disk
- filesystem for /path/to/mutex
and never a directory residing
+ The default directory is httpd's run-time file directory,
+ DefaultRuntimeDir. If a relative
+ path is provided, it is relative to
+ DefaultRuntimeDir. Always use a local
+ disk filesystem for /path/to/mutex
and never a directory residing
on a NFS- or AFS-filesystem. The basename of the file will be the mutex
type, an optional instance string provided by the module, and unless the
OmitPID
keyword is specified, the process id of the httpd
diff --git a/docs/manual/mod/mod_ldap.xml b/docs/manual/mod/mod_ldap.xml
index bce703e884..6afb1779be 100644
--- a/docs/manual/mod/mod_ldap.xml
+++ b/docs/manual/mod/mod_ldap.xml
@@ -418,13 +418,16 @@ LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem
LDAPSharedCacheFile
Sets the shared memory cache file
-LDAPSharedCacheFile directory-path/filename
+LDAPSharedCacheFile file-path
server config
- Specifies the directory path and file name of the shared memory
- cache file. If not set, anonymous shared memory will be used if the
- platform supports it.
+ Specifies the path of the shared memory cache file. If not set,
+ anonymous shared memory will be used if the platform supports it.
+
+ If file-path is not an absolute path, the location specified
+ will be relative to the value of
+ DefaultRuntimeDir.
diff --git a/docs/manual/mod/mod_socache_dbm.xml b/docs/manual/mod/mod_socache_dbm.xml
index 9cb636c92d..bd627f08eb 100644
--- a/docs/manual/mod/mod_socache_dbm.xml
+++ b/docs/manual/mod/mod_socache_dbm.xml
@@ -38,6 +38,9 @@
dbm:/path/to/datafile
+
If the path is not absolute then it is assumed to be relative to
+ the DefaultRuntimeDir.
+
Details of other shared object cache providers can be found
here.
diff --git a/docs/manual/mod/mod_socache_shmcb.xml b/docs/manual/mod/mod_socache_shmcb.xml
index 9c6e61dad0..7ee9c96042 100644
--- a/docs/manual/mod/mod_socache_shmcb.xml
+++ b/docs/manual/mod/mod_socache_shmcb.xml
@@ -38,6 +38,9 @@
shmcb:/path/to/datafile(512000)
+ If the path is not absolute then it is assumed to be relative to
+ the DefaultRuntimeDir.
+
Details of other shared object cache providers can be found
here.
diff --git a/docs/manual/mod/mpm_common.xml b/docs/manual/mod/mpm_common.xml
index 853003c257..8ee8237459 100644
--- a/docs/manual/mod/mpm_common.xml
+++ b/docs/manual/mod/mpm_common.xml
@@ -130,7 +130,7 @@ will exit.
File where the server records the process ID
of the daemon
PidFile filename
-PidFile logs/httpd.pid
+PidFile httpd.pid
server config
eventmpm_winnt
mpmt_os2preforkworker
@@ -140,7 +140,7 @@ of the daemon
The PidFile directive sets the file to
which the server records the process id of the daemon. If the
filename is not absolute then it is assumed to be relative to the
- ServerRoot.
+ DefaultRuntimeDir.
Example
@@ -456,7 +456,7 @@ spikes
Location of the file used to store coordination data for
the child processes
ScoreBoardFile file-path
-ScoreBoardFile logs/apache_runtime_status
+ScoreBoardFile apache_runtime_status
server config
eventmpm_winnt
preforkworker
@@ -470,6 +470,10 @@ the child processes
disk (using file-based shared memory). Specifying this directive causes
Apache httpd to always create the file on the disk.
+ If file-path is not an absolute path, the location specified
+ will be relative to the value of
+ DefaultRuntimeDir.
+
Example
ScoreBoardFile /var/run/apache_runtime_status
diff --git a/include/ap_config.h b/include/ap_config.h
index 944b16afe9..b8ceedc78c 100644
--- a/include/ap_config.h
+++ b/include/ap_config.h
@@ -141,7 +141,7 @@
/* Where the main/parent process's pid is logged */
#ifndef DEFAULT_PIDLOG
-#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
+#define DEFAULT_PIDLOG "httpd.pid"
#endif
#if defined(NETWARE)
diff --git a/include/heartbeat.h b/include/heartbeat.h
index 7f9ed38521..394aed8cc7 100644
--- a/include/heartbeat.h
+++ b/include/heartbeat.h
@@ -47,6 +47,11 @@ typedef struct hm_slot_server_t
int id;
} hm_slot_server_t;
+/* default name of heartbeat data file, created in the configured
+ * runtime directory when mod_slotmem_shm is not available
+ */
+#define DEFAULT_HEARTBEAT_STORAGE "hb.dat"
+
#ifdef __cplusplus
}
#endif
diff --git a/include/http_log.h b/include/http_log.h
index acad032817..7fc31a6f07 100644
--- a/include/http_log.h
+++ b/include/http_log.h
@@ -570,7 +570,7 @@ AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s);
* Log the current pid of the parent process
* @param p The pool to use for processing
* @param fname The name of the file to log to. If the filename is not
- * absolute then it is assumed to be relative to ServerRoot.
+ * absolute then it is assumed to be relative to DefaultRuntimeDir.
*/
AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
@@ -578,15 +578,15 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
* Remove the pidfile.
* @param p The pool to use for processing
* @param fname The name of the pid file to remove. If the filename is not
- * absolute then it is assumed to be relative to ServerRoot.
+ * absolute then it is assumed to be relative to DefaultRuntimeDir.
*/
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *fname);
/**
* Retrieve the pid from a pidfile.
* @param p The pool to use for processing
- * @param filename The name of the file containing the pid. If the filename is not
- * absolute then it is assumed to be relative to ServerRoot.
+ * @param filename The name of the file containing the pid. If the filename
+ * is not absolute then it is assumed to be relative to DefaultRuntimeDir.
* @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
*/
AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
diff --git a/include/scoreboard.h b/include/scoreboard.h
index 2fd2960e49..393cbe9f29 100644
--- a/include/scoreboard.h
+++ b/include/scoreboard.h
@@ -40,7 +40,7 @@ extern "C" {
/* Scoreboard file, if there is one */
#ifndef DEFAULT_SCOREBOARD
-#define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
+#define DEFAULT_SCOREBOARD "apache_runtime_status" /* within DEFAULT_REL_RUNTIMEDIR */
#endif
/* Scoreboard info on a process is, for now, kept very brief ---
diff --git a/modules/cache/mod_socache_dbm.c b/modules/cache/mod_socache_dbm.c
index 0d7c302baf..984d2b7111 100644
--- a/modules/cache/mod_socache_dbm.c
+++ b/modules/cache/mod_socache_dbm.c
@@ -84,7 +84,7 @@ static const char *socache_dbm_create(ap_socache_instance_t **context,
*context = ctx = apr_pcalloc(p, sizeof *ctx);
if (arg && *arg) {
- ctx->data_file = ap_server_root_relative(p, arg);
+ ctx->data_file = ap_runtime_dir_relative(p, arg);
if (!ctx->data_file) {
return apr_psprintf(tmp, "Invalid cache file path %s", arg);
}
diff --git a/modules/cache/mod_socache_shmcb.c b/modules/cache/mod_socache_shmcb.c
index 4c892d07ce..e86e7de576 100644
--- a/modules/cache/mod_socache_shmcb.c
+++ b/modules/cache/mod_socache_shmcb.c
@@ -285,7 +285,7 @@ static const char *socache_shmcb_create(ap_socache_instance_t **context,
return NULL;
}
- ctx->data_file = path = ap_server_root_relative(p, arg);
+ ctx->data_file = path = ap_runtime_dir_relative(p, arg);
cp = strrchr(path, '(');
cp2 = path + strlen(path) - 1;
diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c
index 527bc38e11..8e4231dc37 100644
--- a/modules/cluster/mod_heartmonitor.c
+++ b/modules/cluster/mod_heartmonitor.c
@@ -792,7 +792,7 @@ static void *hm_create_config(apr_pool_t *p, server_rec *s)
hm_ctx_t *ctx = (hm_ctx_t *) apr_palloc(p, sizeof(hm_ctx_t));
ctx->active = 0;
- ctx->storage_path = ap_server_root_relative(p, "logs/hb.dat");
+ ctx->storage_path = ap_runtime_dir_relative(p, DEFAULT_HEARTBEAT_STORAGE);
/* TODO: Add directive for tuning the update interval
*/
ctx->interval = apr_time_from_sec(HM_UPDATE_SEC);
@@ -816,7 +816,7 @@ static const char *cmd_hm_storage(cmd_parms *cmd,
return err;
}
- ctx->storage_path = ap_server_root_relative(p, path);
+ ctx->storage_path = ap_runtime_dir_relative(p, path);
return NULL;
}
diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c
index c7f7b93df1..ad2c395948 100644
--- a/modules/ldap/util_ldap.c
+++ b/modules/ldap/util_ldap.c
@@ -2103,7 +2103,7 @@ static const char *util_ldap_set_cache_file(cmd_parms *cmd, void *dummy,
}
if (file) {
- st->cache_file = ap_server_root_relative(st->pool, file);
+ st->cache_file = ap_runtime_dir_relative(st->pool, file);
}
else {
st->cache_file = NULL;
diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c
index 26c8158468..77fb994ff1 100644
--- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c
+++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c
@@ -407,7 +407,7 @@ static void *lb_hb_create_config(apr_pool_t *p, server_rec *s)
{
lb_hb_ctx_t *ctx = (lb_hb_ctx_t *) apr_palloc(p, sizeof(lb_hb_ctx_t));
- ctx->path = ap_server_root_relative(p, "logs/hb.dat");
+ ctx->path = ap_runtime_dir_relative(p, DEFAULT_HEARTBEAT_STORAGE);
return ctx;
}
@@ -442,7 +442,7 @@ static const char *cmd_lb_hb_storage(cmd_parms *cmd,
return err;
}
- ctx->path = ap_server_root_relative(p, path);
+ ctx->path = ap_runtime_dir_relative(p, path);
return NULL;
}
diff --git a/modules/slotmem/mod_slotmem_plain.c b/modules/slotmem/mod_slotmem_plain.c
index 47da15b49a..dc62f46f85 100644
--- a/modules/slotmem/mod_slotmem_plain.c
+++ b/modules/slotmem/mod_slotmem_plain.c
@@ -75,7 +75,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, const char *name
if (name[0] == ':')
fname = name;
else
- fname = ap_server_root_relative(pool, name);
+ fname = ap_runtime_dir_relative(pool, name);
/* first try to attach to existing slotmem */
if (next) {
@@ -126,7 +126,7 @@ static apr_status_t slotmem_attach(ap_slotmem_instance_t **new, const char *name
if (name[0] == ':')
fname = name;
else
- fname = ap_server_root_relative(pool, name);
+ fname = ap_runtime_dir_relative(pool, name);
}
else
return APR_ENOSHMAVAIL;
diff --git a/server/core.c b/server/core.c
index 03137577de..5d0e12d668 100644
--- a/server/core.c
+++ b/server/core.c
@@ -4799,7 +4799,7 @@ static void core_dump_config(apr_pool_t *p, server_rec *s)
tmp = s->error_fname;
apr_file_printf(out, "Main ErrorLog: \"%s\"\n", tmp);
if (ap_scoreboard_fname) {
- tmp = ap_server_root_relative(p, ap_scoreboard_fname);
+ tmp = ap_runtime_dir_relative(p, ap_scoreboard_fname);
apr_file_printf(out, "ScoreBoardFile: \"%s\"\n", tmp);
}
ap_dump_mutexes(p, s, out);
diff --git a/server/log.c b/server/log.c
index b33aa1fc1b..1c9a59bb1e 100644
--- a/server/log.c
+++ b/server/log.c
@@ -1394,7 +1394,7 @@ AP_DECLARE(void) ap_log_command_line(apr_pool_t *plog, server_rec *s)
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *rel_fname)
{
apr_status_t rv;
- const char *fname = ap_server_root_relative(p, rel_fname);
+ const char *fname = ap_runtime_dir_relative(p, rel_fname);
if (fname != NULL) {
rv = apr_file_remove(fname, p);
@@ -1423,7 +1423,7 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
return;
}
- fname = ap_server_root_relative(p, filename);
+ fname = ap_runtime_dir_relative(p, filename);
if (!fname) {
ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, APR_EBADPATH,
NULL, APLOGNO(00097) "Invalid PID file path %s, ignoring.", filename);
@@ -1476,7 +1476,7 @@ AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename,
return APR_EGENERAL;
}
- fname = ap_server_root_relative(p, filename);
+ fname = ap_runtime_dir_relative(p, filename);
if (!fname) {
ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, APR_EBADPATH,
NULL, APLOGNO(00101) "Invalid PID file path %s, ignoring.", filename);
diff --git a/server/mpm_common.c b/server/mpm_common.c
index 4448ec60dc..e33bd11c9e 100644
--- a/server/mpm_common.c
+++ b/server/mpm_common.c
@@ -307,7 +307,7 @@ const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out)
{
apr_file_printf(out, "PidFile: \"%s\"\n",
- ap_server_root_relative(p, ap_pid_fname));
+ ap_runtime_dir_relative(p, ap_pid_fname));
}
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
diff --git a/server/scoreboard.c b/server/scoreboard.c
index bef2b90908..67b0386c4b 100644
--- a/server/scoreboard.c
+++ b/server/scoreboard.c
@@ -217,7 +217,7 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf)
/* The config says to create a name-based shmem */
if (ap_scoreboard_fname) {
/* make sure it's an absolute pathname */
- fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
+ fname = ap_runtime_dir_relative(pconf, ap_scoreboard_fname);
if (!fname) {
ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, ap_server_conf, APLOGNO(00003)
"Fatal error: Invalid Scoreboard path %s",
@@ -239,7 +239,7 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf)
else if (rv == APR_ENOTIMPL) {
/* Make sure it's an absolute pathname */
ap_scoreboard_fname = DEFAULT_SCOREBOARD;
- fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
+ fname = ap_runtime_dir_relative(pconf, ap_scoreboard_fname);
return create_namebased_scoreboard(global_pool, fname);
}
diff --git a/server/util_mutex.c b/server/util_mutex.c
index e49cca5570..72bb8f6e06 100644
--- a/server/util_mutex.c
+++ b/server/util_mutex.c
@@ -117,7 +117,7 @@ AP_DECLARE(apr_status_t) ap_parse_mutex(const char *arg, apr_pool_t *pool,
* are looking to use
*/
if (file) {
- *mutexfile = ap_server_root_relative(pool, file);
+ *mutexfile = ap_runtime_dir_relative(pool, file);
if (!*mutexfile) {
return APR_BADARG;
}
@@ -304,7 +304,7 @@ static const char *get_mutex_filename(apr_pool_t *p, mutex_cfg_t *mxcfg,
}
#endif
- return ap_server_root_relative(p,
+ return ap_runtime_dir_relative(p,
apr_pstrcat(p,
mxcfg->dir,
"/",
@@ -552,7 +552,7 @@ AP_CORE_DECLARE(void) ap_dump_mutexes(apr_pool_t *p, server_rec *s, apr_file_t *
}
if (mxcfg->dir)
- dir = ap_server_root_relative(p, mxcfg->dir);
+ dir = ap_runtime_dir_relative(p, mxcfg->dir);
apr_file_printf(out, "Mutex %s: dir=\"%s\" mechanism=%s %s\n", name, dir, mech,
mxcfg->omit_pid ? "[OmitPid]" : "");