Hi all...
I just noticed that when httpd.conf is a directory
/usr/local/apache/httpd.conf/.apaci.install.tmp is installed, and thus it is
slurped up when the files in httpd.conf are processed. this helps (sorry if
it wraps)
Index: Makefile.tmpl
===================================================================
RCS file: /home/cvspublic/apache-1.3/Makefile.tmpl,v
retrieving revision 1.99
diff -u -r1.99 Makefile.tmpl
--- Makefile.tmpl 2001/01/15 16:26:17 1.99
+++ Makefile.tmpl 2001/05/15 18:29:38
@@ -526,7 +526,7 @@
> $(TOP)/$(SRC)/.apaci.install.tmp && \
echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*]
$(root)$(sysconfdir)/$${target_conf}.default"; \
$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp
$(root)$(sysconfdir)/$${target_conf}.default; \
- if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
+ if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ] && [ ! -d
"$(root)$(sysconfdir)/$${target_conf}" ]; then \
echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*]
$(root)$(sysconfdir)/$${target_conf}"; \
$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp
$(root)$(sysconfdir)/$${target_conf}; \
else \
A while ago, I brought up that it would be nice to be able to ignore
certain files in an httpd.conf directory (for instance hidden files like
.apaci.install.tmp). Will Rowe suggested ignoring files that didn't either
start with or end with a letter or number
(http://marc.theaimsgroup.com/?l=apache-new-httpd&m=97870639128109&w=2) but
then the discussion died.
I've been running this patch for a while now, which is a bit different than
last one I suggested, but it still uses regexes. Just in case interest is
resurrected :)
--Geoff
Index: http_config.c
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/main/http_config.c,v
retrieving revision 1.159
diff -u -r1.159 http_config.c
--- http_config.c 2001/01/24 02:11:09 1.159
+++ http_config.c 2001/05/15 18:24:15
@@ -1211,6 +1211,7 @@
const char *errmsg;
cmd_parms parms;
struct stat finfo;
+ regex_t *r = NULL;
fname = ap_server_root_relative(p, fname);
@@ -1259,12 +1260,18 @@
}
candidates = ap_make_array(p, 1, sizeof(fnames));
while ((dir_entry = readdir(dirp)) != NULL) {
- /* strip out '.' and '..' */
- if (strcmp(dir_entry->d_name, ".") &&
- strcmp(dir_entry->d_name, "..")) {
- fnew = (fnames *) ap_push_array(candidates);
- fnew->fname = ap_make_full_path(p, fname,
dir_entry->d_name);
- }
+ /*
+ * strip out any files not starting with
+ * or ending with a letter or number
+ */
+ r = ap_pregcomp(p, "^[^a-zA-Z0-9]|[^a-zA-Z0-9]$",
REG_EXTENDED);
+ if (!ap_regexec(r, dir_entry->d_name, 0, NULL, 0)) {
+ fprintf(stderr, " Skipping config file: %s\n",
dir_entry->d_name);
+ }
+ else {
+ fnew = (fnames *) ap_push_array(candidates);
+ fnew->fname = ap_make_full_path(p, fname,
dir_entry->d_name);
+ }
}
ap_pclosedir(p, dirp);
if (candidates->nelts != 0) {
[geoff@spinnaker apache]$ sapache start
Processing config directory: /usr/local/apache/conf/httpd.conf
Skipping config file: .
Skipping config file: ..
Skipping config file: .hidden
Skipping config file: ~file
Skipping config file: file~
Processing config file: /usr/local/apache/conf/httpd.conf/anotherdir
Processing config directory: /usr/local/apache/conf/httpd.conf/anotherdir
Skipping config file: .
Skipping config file: ..
Skipping config file: .anotherhiddenfile
Processing config file: /usr/local/apache/conf/httpd.conf/whole.conf
/usr/local/apache/bin/apachectl start: httpd started