git-instaweb: Fix custom apache log placement
PATCH 1/3 git-instaweb: Fix custom apache log placement
'CustomLog' is provided by mod_log_config so we need to include the module in our generated config. This was added in d94775e1f9a.
--- git-instaweb.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-instaweb.sh +1 -1
@@ -314,7 +314,7 @@ PidFile "$fqgitdir/pid" Listen $bind$port EOF - for mod in mime dir; do + for mod in mime dir log_config; do if test -e $module_path/mod_${mod}.so; then echo "LoadModule ${mod}_module " \ "$module_path/mod_${mod}.so" >> "$conf"
Signature · 1 line
1.7.1
PATCH 2/3 git-instaweb: Fix Apache environment variable passing
We were passing the non-existent GIT_EXEC_DIR through instead of the real GIT_EXEC_PATH. In addition, these weren't being passed at all for CGI (non mod_perl) execution so get them included there as well.
--- git-instaweb.sh | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
git-instaweb.sh +5 -2
@@ -314,7 +314,7 @@ PidFile "$fqgitdir/pid" Listen $bind$port EOF - for mod in mime dir log_config; do + for mod in mime dir env log_config; do if test -e $module_path/mod_${mod}.so; then echo "LoadModule ${mod}_module " \ "$module_path/mod_${mod}.so" >> "$conf"
@@ -334,7 +334,7 @@ EOF cat >> "$conf" <<EOF LoadModule perl_module $module_path/mod_perl.so PerlPassEnv GIT_DIR -PerlPassEnv GIT_EXEC_DIR +PerlPassEnv GIT_EXEC_PATH PerlPassEnv GITWEB_CONFIG <Location /gitweb.cgi> SetHandler perl-script
@@ -364,6 +364,9 @@ EOF echo "ScriptSock logs/gitweb.sock" >> "$conf" fi cat >> "$conf" <<EOF +PassEnv GIT_DIR +PassEnv GIT_EXEC_PATH +PassEnv GITWEB_CONFIG AddHandler cgi-script .cgi <Location /gitweb.cgi> Options +ExecCGI
Signature · 1 line
1.7.1
PATCH 3/3 git-instaweb: Don't assume Apache executable is named apache2
In reply to Dan McGeeOn Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules. Remove some of these assumptions and add the httpd name in where it may be required.
--- git-instaweb.sh | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
git-instaweb.sh +7 -3
@@ -43,7 +43,8 @@ test -z "$port" && port=1234 resolve_full_httpd () { case "$httpd" in - *apache2*|*lighttpd*) + *apache2*|*lighttpd*|*httpd*) + # yes, *httpd* covers *lighttpd* above, but it is there for clarity # ensure that the apache2/lighttpd command ends with "-f" if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1 then
@@ -300,7 +301,10 @@ EOF } apache2_conf () { - test -z "$module_path" && module_path=/usr/lib/apache2/modules + if test -z "$module_path"; then + test -d "/usr/lib/httpd/modules" && module_path="/usr/lib/httpd/modules" + test -d "/usr/lib/apache2/modules" && module_path="/usr/lib/apache2/modules" + fi bind= test x"$local" = xtrue && bind='127.0.0.1:' echo 'text/css css' > "$fqgitdir/mime.types"
@@ -563,7 +567,7 @@ case "$httpd" in *lighttpd*) lighttpd_conf ;; -*apache2*) +*apache2*|*httpd*) apache2_conf ;; webrick)
Signature · 1 line
1.7.1
Re: [PATCH 3/3] git-instaweb: Don't assume Apache executable is named apache2
Quoted 5 lines · Dan McGee
On Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules. Remove some of these assumptions and add the httpd name in where it may be required.
Signed-off-by Dan McGee <[email protected]>
Thanks Dan,
Everything in this series looks reasonable to me (haven't tested):
git-instaweb.sh EOF · line 307
Quoted 8 lines
git-instaweb.sh +4
-1apache2_conf () { - test -z "$module_path" && module_path=/usr/lib/apache2/modules + if test -z "$module_path"; then + test -d "/usr/lib/httpd/modules" && module_path="/usr/lib/httpd/modules" + test -d "/usr/lib/apache2/modules" && module_path="/usr/lib/apache2/modules" + fi
Minor style nitpicks (feel free to ignore unless somebody else feels more strongly):
The preferred style in git is to have the "then" statement on a separate line, omitting the semi-colon, but there remain plenty of examples contrary in our code:
Likewise with "for i in x y z; do"
We also prefer to keep lines shorter than 80 characters (hard tabs being 8 chars), but we also have plenty of examples contrary to that in instaweb, too :x
Signature · 1 line
Eric Wong
PATCH 3/3 git-instaweb: Don't assume Apache executable is named apache2
On Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules. Remove some of these assumptions and add the httpd name in where it may be required. Finally, make some slight style adjustments to the code we are touching to make it fit the style of the rest of the script.
---
Style cleanups as suggested by Eric, at least to the parts of the code I touched.
-Dan
git-instaweb.sh | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-)
git-instaweb.sh +14 -5
@@ -43,7 +43,8 @@ test -z "$port" && port=1234 resolve_full_httpd () { case "$httpd" in - *apache2*|*lighttpd*) + *apache2*|*lighttpd*|*httpd*) + # yes, *httpd* covers *lighttpd* above, but it is there for clarity # ensure that the apache2/lighttpd command ends with "-f" if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1 then
@@ -300,7 +301,13 @@ EOF } apache2_conf () { - test -z "$module_path" && module_path=/usr/lib/apache2/modules + if test -z "$module_path" + then + test -d "/usr/lib/httpd/modules" && + module_path="/usr/lib/httpd/modules" + test -d "/usr/lib/apache2/modules" && + module_path="/usr/lib/apache2/modules" + fi bind= test x"$local" = xtrue && bind='127.0.0.1:' echo 'text/css css' > "$fqgitdir/mime.types"
@@ -314,8 +321,10 @@ PidFile "$fqgitdir/pid" Listen $bind$port EOF - for mod in mime dir env log_config; do - if test -e $module_path/mod_${mod}.so; then + for mod in mime dir env log_config + do + if test -e $module_path/mod_${mod}.so + then echo "LoadModule ${mod}_module " \ "$module_path/mod_${mod}.so" >> "$conf" fi
@@ -563,7 +572,7 @@ case "$httpd" in *lighttpd*) lighttpd_conf ;; -*apache2*) +*apache2*|*httpd*) apache2_conf ;; webrick)
Signature · 1 line
1.7.1
Re: [PATCH 3/3] git-instaweb: Don't assume Apache executable is named apache2
In reply to Dan McGeeQuoted 2 lines · Dan McGee
On Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules.
Sorry, but I cannot parse the last 6 words here.
git-instaweb.sh test -z "$port" && port=1234 · line 47
Quoted 8 lines
Remove some of these assumptions
and add the httpd name in where it may be required.
...
resolve_full_httpd() {git-instaweb.sh +2
-1case "$httpd" in - *apache2*|*lighttpd*) + *apache2*|*lighttpd*|*httpd*) + # yes, *httpd* covers *lighttpd* above, but it is there for clarity
That may make things work better on Arch but I wonder if there are platforms that allow users to point at their favorite, non-Apache, http server with a canonical name "httpd" that gets broken by this change. Am I being too paranoid?
Other two patches looked very sane. Thanks.
Re: [PATCH 3/3] git-instaweb: Don't assume Apache executable is named apache2
In reply to a message not in the archiveQuoted 6 lines · Junio C Hamano
Quoted 2 lines · Dan McGee
On Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules.
Sorry, but I cannot parse the last 6 words here.
On Arch Linux, the executable for the Apache HTTP server keeps the 'httpd' name and is not named 'apache2'. The path to the server modules also contains 'httpd' rather than 'apache2'.
Quoted 9 lines
Quoted 8 lines
Remove some of these assumptions
and add the httpd name in where it may be required.
...
resolve_full_httpd () {
case "$httpd" in
- *apache2*|*lighttpd*)
+ *apache2*|*lighttpd*|*httpd*)
+ # yes, *httpd* covers *lighttpd* above, but it is there for clarity
Quoted 4 lines
That may make things work better on Arch but I wonder if there are platforms that allow users to point at their favorite, non-Apache, http server with a canonical name "httpd" that gets broken by this change. Am I being too paranoid?
I think you are being overcautious. Even in this case, you can specify the real name of the web server through git-config or command line parameters to make sure it picks up the right settings. In addition, any web server named 'httpd' wouldn't have worked before anyway so we aren't regressing here. Finally, I've not encountered any platform that does this kind of canonical naming as web servers have very different command line flags and interfaces anyway.
Quoted 1 line
Other two patches looked very sane. Thanks.
No problem.
-Dan
Quoted 4 lines · Dan McGee
'CustomLog' is provided by
mod_log_configso we need to include the module in our generated config. This was added ind94775e1f9a.Signed-off-by Dan McGee <[email protected]>
I noticed this set of patches didn't go anywhere...at least the first two were more bug fixes than improvements so I would have expected them to get into 1.7.2. Did they get lost in the shuffle?
1: http://marc.info/?l=git&m=127786592330110&w=2
2: http://marc.info/?l=git&m=127786592030105&w=2
3: http://marc.info/?l=git&m=127791591706076&w=2
-Dan
Quoted 21 lines
---
git-instaweb.sh | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)git-instaweb.sh +0
-0@@ -314,7 +314,7 @@ PidFile "$fqgitdir/pid"Listen $bind$port
EOF- for mod in mime dir; do
+ for mod in mime dirlog_config; do
if test -e $module_path/mod_${mod}.so; then echo "LoadModule ${mod}_module " \
"$module_path/mod_${mod}.so" >> "$conf" --
1.7.1
Eric Wong
Acked-byRe: [PATCH 3/3] git-instaweb: Don't assume Apache executable is named apache2
In reply to Dan McGeeQuoted 11 lines · Dan McGee
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Dan McGee
On Arch Linux, we keep the original 'httpd' name for the exectuable and don't rename it or the path to the modules.
Sorry, but I cannot parse the last 6 words here.
On Arch Linux, the executable for the Apache HTTP server keeps the 'httpd' name and is not named 'apache2'. The path to the server modules also contains 'httpd' rather than 'apache2'.
(I missed this message the first time around since I wasn't Cc-ed).
Thanks Dan,
I've pushed your series of patches up to my "instaweb" branch ongit://git.bogomips.org/git-svn and reworked the commit message of 3/3 below:
Quoted 1 line
From
4bdf85995b5d21fdb085a480d529c8da0314189eMon Sep 17 00:00:00 2001
From: Dan McGee <[email protected]>
Date: Wed, 30 Jun 2010 07:29:08 -0500
Subject: [PATCH] git-instaweb: Don't assume Apache executable is named apache2
On Arch Linux, the executable for the Apache HTTP server keeps the 'httpd' name and is not named 'apache2'. The path to the server modules also contains 'httpd' rather than 'apache2'. Remove some of these assumptions and add the httpd name in where it may be required. Finally, make some slight style adjustments to the code we are touching to make it fit the style of the rest of the script.
--- git-instaweb.sh | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-)
git-instaweb.sh +14 -5
@@ -43,7 +43,8 @@ test -z "$port" && port=1234 resolve_full_httpd () { case "$httpd" in - *apache2*|*lighttpd*) + *apache2*|*lighttpd*|*httpd*) + # yes, *httpd* covers *lighttpd* above, but it is there for clarity # ensure that the apache2/lighttpd command ends with "-f" if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1 then
@@ -300,7 +301,13 @@ EOF } apache2_conf () { - test -z "$module_path" && module_path=/usr/lib/apache2/modules + if test -z "$module_path" + then + test -d "/usr/lib/httpd/modules" && + module_path="/usr/lib/httpd/modules" + test -d "/usr/lib/apache2/modules" && + module_path="/usr/lib/apache2/modules" + fi bind= test x"$local" = xtrue && bind='127.0.0.1:' echo 'text/css css' > "$fqgitdir/mime.types"
@@ -314,8 +321,10 @@ PidFile "$fqgitdir/pid" Listen $bind$port EOF - for mod in mime dir env log_config; do - if test -e $module_path/mod_${mod}.so; then + for mod in mime dir env log_config + do + if test -e $module_path/mod_${mod}.so + then echo "LoadModule ${mod}_module " \ "$module_path/mod_${mod}.so" >> "$conf" fi
@@ -563,7 +572,7 @@ case "$httpd" in *lighttpd*) lighttpd_conf ;; -*apache2*) +*apache2*|*httpd*) apache2_conf ;; webrick)
Signature · 1 line
Eric Wong
Quoted 6 lines · Dan McGee
Quoted 4 lines · Dan McGee
'CustomLog' is provided by
mod_log_configso we need to include the module in our generated config. This was added ind94775e1f9a.Signed-off-by Dan McGee <[email protected]>
Quoted 7 lines
I noticed this set of patches didn't go anywhere...at least the first two were more bug fixes than improvements so I would have expected them to get into 1.7.2. Did they get lost in the shuffle?
1: http://marc.info/?l=git&m=127786592330110&w=2
2: http://marc.info/?l=git&m=127786592030105&w=2
3: http://marc.info/?l=git&m=127791591706076&w=2
Hi Dan, can you address Junio's concerns here?
http://marc.info/?l=git&m=127791382102449&w=2
Thanks.
Signature · 1 line
Eric Wong
Quoted 11 lines · Eric Wong
Quoted 10 lines · Dan McGee
Quoted 4 lines · Dan McGee
'CustomLog' is provided by
mod_log_configso we need to include the module in our generated config. This was added ind94775e1f9a.Signed-off-by Dan McGee <[email protected]>I noticed this set of patches didn't go anywhere...at least the first two were more bug fixes than improvements so I would have expected them to get into 1.7.2. Did they get lost in the shuffle?
Quoted 7 lines
Quoted 3 lines
1: http://marc.info/?l=git&m=127786592330110&w=2
2: http://marc.info/?l=git&m=127786592030105&w=2
3: http://marc.info/?l=git&m=127791591706076&w=2Hi Dan, can you address Junio's concerns here?
I did already, and got no feedback...
http://marc.info/?l=git&m=127791591706076&w=2
-Dan
Quoted 8 lines · Dan McGee
On Thu, Jul 22, 2010 at 6:42 PM, Eric Wong <[email protected]> wrote:
...Quoted 3 lines
Hi Dan, can you address Junio's concerns here?
I did already, and got no feedback...
http://marc.info/?l=git&m=127791591706076&w=2
Thanks for a (half-) pointer [*1*]; I didn't see that message til now.
Quoted 3 lines
Quoted 3 lines
I think you are being overcautious. Even in this case, you can specify the real name of the web server through git-config or command line parameters to make sure it picks up the right settings.
If there is an HTTP server "httpd" that does not understand Apache style configuration file given via "-f" (use of which is a misconfiguration this patch will start allowing users to make), we would need to add a new codepath to the script to generate a configuration file to support that server. I do not think we have a mechanism to disambiguate different HTTP server implementations that claim to be "httpd", so at that point we would need to add something other than the command name for disambiguation. But for now I think your patch suffices.
As you pointed out, the last "case" statement in instaweb explicitly have rejected servers we did not know about, so my worry was unfounded; nobody could have been using a daemon whose name is "httpd", be it ArchLinux's Apache or something incompatible.
Thanks.
[Footnote]
*1* Links to marc do not have an easy way other than re-typing to get to a usable message-id to find the message to reply to, so while I wanted to make this as a reply to your message from June 30th, I couldn't, and instead I am sending this as a reply to the new message, and I had to copy and paste the parts of the message I responded to.