From 577acc2d12f51feff38ed413b6efede9a8eb0b2e Mon Sep 17 00:00:00 2001
From: Jeff Trawick
Date: Tue, 14 Aug 2012 23:59:24 +0000
Subject: [PATCH] Revert r1373105, the merging of incompatible
DefaultRuntimeDir changes.
The trunk patches for these all have some configuration breakage
as 2.4.x interprets the individual directive or API parameter as
relative to ServerRoot whereas trunk interprets everything
relative to DefaultRuntimeDir.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1373168 13f79535-47bb-0310-9956-ffa450edef68
---
CHANGES | 13 ++++++------
STATUS | 21 +++++++++++++++++++
docs/conf/extra/httpd-mpm.conf.in | 2 +-
docs/conf/extra/httpd-ssl.conf.in | 4 ++--
docs/manual/mod/core.xml | 8 +++----
docs/manual/mod/mod_ldap.xml | 11 ++++------
docs/manual/mod/mod_socache_dbm.xml | 3 ---
docs/manual/mod/mod_socache_shmcb.xml | 3 ---
docs/manual/mod/mpm_common.xml | 10 +++------
include/ap_config.h | 2 +-
include/heartbeat.h | 5 -----
include/http_log.h | 8 +++----
include/scoreboard.h | 2 +-
modules/cache/mod_socache_dbm.c | 2 +-
modules/cache/mod_socache_shmcb.c | 2 +-
modules/cluster/mod_heartmonitor.c | 4 ++--
modules/ldap/util_ldap.c | 2 +-
.../proxy/balancers/mod_lbmethod_heartbeat.c | 4 ++--
modules/slotmem/mod_slotmem_plain.c | 4 ++--
server/core.c | 2 +-
server/log.c | 6 +++---
server/mpm_common.c | 2 +-
server/scoreboard.c | 4 ++--
server/util_mutex.c | 6 +++---
24 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/CHANGES b/CHANGES
index 3e1921905e..3f0893199a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,14 +16,8 @@ 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
- - 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]
+ [Jeff Trawick]
*) htpasswd: Use correct file mode for checking if file is writable.
PR 45923. [Stefan Fritsch]
@@ -84,6 +78,11 @@ 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 5a47375e45..cf1e0da4f1 100644
--- a/STATUS
+++ b/STATUS
@@ -89,6 +89,27 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
+ * 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 0506d2fc91..bf29fafe00 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 "httpd.pid"
+ PidFile "@rel_runtimedir@/httpd.pid"
#
diff --git a/docs/conf/extra/httpd-ssl.conf.in b/docs/conf/extra/httpd-ssl.conf.in
index 33db96d2fe..673d1aa816 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:ssl_scache"
-SSLSessionCache "shmcb:ssl_scache(512000)"
+#SSLSessionCache "dbm:@exp_runtimedir@/ssl_scache"
+SSLSessionCache "shmcb:@exp_runtimedir@/ssl_scache(512000)"
SSLSessionCacheTimeout 300
##
diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml
index e4dd46763f..5d69de1742 100644
--- a/docs/manual/mod/core.xml
+++ b/docs/manual/mod/core.xml
@@ -3142,11 +3142,9 @@ 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,
- 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
+ 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
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 6afb1779be..bce703e884 100644
--- a/docs/manual/mod/mod_ldap.xml
+++ b/docs/manual/mod/mod_ldap.xml
@@ -418,16 +418,13 @@ LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem
LDAPSharedCacheFile
Sets the shared memory cache file
-LDAPSharedCacheFile file-path
+LDAPSharedCacheFile directory-path/filename
server config
- 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.
+ 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.
diff --git a/docs/manual/mod/mod_socache_dbm.xml b/docs/manual/mod/mod_socache_dbm.xml
index bd627f08eb..9cb636c92d 100644
--- a/docs/manual/mod/mod_socache_dbm.xml
+++ b/docs/manual/mod/mod_socache_dbm.xml
@@ -38,9 +38,6 @@
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 7ee9c96042..9c6e61dad0 100644
--- a/docs/manual/mod/mod_socache_shmcb.xml
+++ b/docs/manual/mod/mod_socache_shmcb.xml
@@ -38,9 +38,6 @@
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 8ee8237459..853003c257 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 httpd.pid
+PidFile logs/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
- DefaultRuntimeDir.
+ ServerRoot.
Example
@@ -456,7 +456,7 @@ spikes
Location of the file used to store coordination data for
the child processes
ScoreBoardFile file-path
-ScoreBoardFile apache_runtime_status
+ScoreBoardFile logs/apache_runtime_status
server config
eventmpm_winnt
preforkworker
@@ -470,10 +470,6 @@ 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 b8ceedc78c..944b16afe9 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 "httpd.pid"
+#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
#endif
#if defined(NETWARE)
diff --git a/include/heartbeat.h b/include/heartbeat.h
index 394aed8cc7..7f9ed38521 100644
--- a/include/heartbeat.h
+++ b/include/heartbeat.h
@@ -47,11 +47,6 @@ 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 7fc31a6f07..acad032817 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 DefaultRuntimeDir.
+ * absolute then it is assumed to be relative to ServerRoot.
*/
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 DefaultRuntimeDir.
+ * absolute then it is assumed to be relative to ServerRoot.
*/
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 DefaultRuntimeDir.
+ * @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 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 393cbe9f29..2fd2960e49 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 "apache_runtime_status" /* within DEFAULT_REL_RUNTIMEDIR */
+#define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
#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 984d2b7111..0d7c302baf 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_runtime_dir_relative(p, arg);
+ ctx->data_file = ap_server_root_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 e86e7de576..4c892d07ce 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_runtime_dir_relative(p, arg);
+ ctx->data_file = path = ap_server_root_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 8e4231dc37..527bc38e11 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_runtime_dir_relative(p, DEFAULT_HEARTBEAT_STORAGE);
+ ctx->storage_path = ap_server_root_relative(p, "logs/hb.dat");
/* 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_runtime_dir_relative(p, path);
+ ctx->storage_path = ap_server_root_relative(p, path);
return NULL;
}
diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c
index ad2c395948..c7f7b93df1 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_runtime_dir_relative(st->pool, file);
+ st->cache_file = ap_server_root_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 77fb994ff1..26c8158468 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_runtime_dir_relative(p, DEFAULT_HEARTBEAT_STORAGE);
+ ctx->path = ap_server_root_relative(p, "logs/hb.dat");
return ctx;
}
@@ -442,7 +442,7 @@ static const char *cmd_lb_hb_storage(cmd_parms *cmd,
return err;
}
- ctx->path = ap_runtime_dir_relative(p, path);
+ ctx->path = ap_server_root_relative(p, path);
return NULL;
}
diff --git a/modules/slotmem/mod_slotmem_plain.c b/modules/slotmem/mod_slotmem_plain.c
index dc62f46f85..47da15b49a 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_runtime_dir_relative(pool, name);
+ fname = ap_server_root_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_runtime_dir_relative(pool, name);
+ fname = ap_server_root_relative(pool, name);
}
else
return APR_ENOSHMAVAIL;
diff --git a/server/core.c b/server/core.c
index 5d0e12d668..03137577de 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_runtime_dir_relative(p, ap_scoreboard_fname);
+ tmp = ap_server_root_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 1c9a59bb1e..b33aa1fc1b 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_runtime_dir_relative(p, rel_fname);
+ const char *fname = ap_server_root_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_runtime_dir_relative(p, filename);
+ fname = ap_server_root_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_runtime_dir_relative(p, filename);
+ fname = ap_server_root_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 e33bd11c9e..4448ec60dc 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_runtime_dir_relative(p, ap_pid_fname));
+ ap_server_root_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 67b0386c4b..bef2b90908 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_runtime_dir_relative(pconf, ap_scoreboard_fname);
+ fname = ap_server_root_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_runtime_dir_relative(pconf, ap_scoreboard_fname);
+ fname = ap_server_root_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 72bb8f6e06..e49cca5570 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_runtime_dir_relative(pool, file);
+ *mutexfile = ap_server_root_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_runtime_dir_relative(p,
+ return ap_server_root_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_runtime_dir_relative(p, mxcfg->dir);
+ dir = ap_server_root_relative(p, mxcfg->dir);
apr_file_printf(out, "Mutex %s: dir=\"%s\" mechanism=%s %s\n", name, dir, mech,
mxcfg->omit_pid ? "[OmitPid]" : "");
--
2.50.1