{"thread":{"id":"13907","subject":"[PATCH] Enhanced auto-discovery of httpd location and call conventions.","startedAt":"2008-06-12T01:51:20Z","lastAt":"2008-06-13T17:02:14Z","messageCount":5,"participants":["Flavio Poletti (polettix)","Jakub Narebski","Flavio Poletti","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"79535","messageId":"1213235480-21925-1-git-send-email-flavio@polettix.it","threadId":"13907","inReplyTo":null,"subject":"[PATCH] Enhanced auto-discovery of httpd location and call conventions.","fromName":"Flavio Poletti (polettix)","fromEmail":"flavio@polettix.it","sentAt":"2008-06-12T01:51:20Z","receivedAt":"2008-06-12T01:51:20Z","isPatch":true,"sender":{"key":"flavio@polettix.it","avatar":"https://gravatar.com/avatar/5466f4891265e5b9f386e334a5a1100866c8a74148e8144a49e4ffef735bf22a?d=mp&s=160"},"body":"This patch allows calling:\n\n   git-instaweb -d apache2\n\nand have the script Do The Right Thing. In particular, the auto-discovery\nmechanism has been extended in order to be used for module listing as\nwell, and the call convention is that if the daemon is apache2/lighttpd\nand the parameter to the \"-d\" option does not end by \"-f\", the \"-f\" is\nadded to the end of the option itself.\n\nAnother minor change is a substitution of a shell sub-call using \"$()\"\nby means of backticks. In my understanding, plain /bin/sh does not support\n\"$()\".\n\nSigned-off-by: Flavio Poletti <flavio@polettix.it>\n---\nHello,\n\n   this is the first time I submit a patch here so please point me to the\nright FM to Read if I've messed up with the standard submission\nprocedure at http://repo.or.cz/w/git.git?a=blob_plain;f=Documentation/SubmittingPatches;hb=HEAD\n\nCheers,\n\n   Flavio.\n\n git-instaweb.sh |   34 +++++++++++++++++++++++++---------\n 1 files changed, 25 insertions(+), 9 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 6f91c8f..cc9d4f3 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -37,11 +37,23 @@ test -z \"$httpd\" && httpd='lighttpd -f'\n # any untaken local port will do...\n test -z \"$port\" && port=1234\n \n-start_httpd () {\n-\thttpd_only=\"`echo $httpd | cut -f1 -d' '`\"\n+resolve_httpd () {\n+\tlocal_httpd=$1\n+\n+\tcase \"$local_httpd\" in\n+\t*apache2*|*lighttpd*)\n+\t\t# ensure that the apache2/lighttpd command ends with \"-f\"\n+\t\tif ! echo \"$local_httpd\" | grep -- '-f *$' >/dev/null 2>&1\n+\t\tthen\n+\t\t\tlocal_httpd=\"$local_httpd -f\"\n+\t\tfi\n+\t\t;;\n+\tesac\n+\n+\thttpd_only=\"`echo $local_httpd | cut -f1 -d' '`\"\n \tif case \"$httpd_only\" in /*) : ;; *) which $httpd_only >/dev/null;; esac\n \tthen\n-\t\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\techo $local_httpd\n \telse\n \t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n \t\t# these days and those are not in most users $PATHs\n@@ -51,16 +63,19 @@ start_httpd () {\n \t\tdo\n \t\t\tif test -x \"$i/$httpd_only\"\n \t\t\tthen\n-\t\t\t\t# don't quote $httpd, there can be\n-\t\t\t\t# arguments to it (-f)\n-\t\t\t\t$i/$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\t\t\techo $i/$local_httpd\n \t\t\t\treturn\n \t\t\tfi\n \t\tdone\n-\t\techo \"$httpd_only not found. Install $httpd_only or use\" \\\n+\t\techo >&2 \"$httpd_only not found. Install $httpd_only or use\" \\\n \t\t     \"--httpd to specify another http daemon.\"\n \t\texit 1\n \tfi\n+}\n+\n+start_httpd () {\n+\t# don't quote $httpd, there can be arguments to it (-f)\n+\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n \tif test $? != 0; then\n \t\techo \"Could not execute http daemon $httpd.\"\n \t\texit 1\n@@ -71,6 +86,7 @@ stop_httpd () {\n \ttest -f \"$fqgitdir/pid\" && kill `cat \"$fqgitdir/pid\"`\n }\n \n+httpd=`resolve_httpd \"$httpd\"`\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -92,7 +108,7 @@ do\n \t\t;;\n \t-d|--httpd)\n \t\tshift\n-\t\thttpd=\"$1\"\n+\t\thttpd=`resolve_httpd \"$1\"`\n \t\t;;\n \t-b|--browser)\n \t\tshift\n@@ -228,7 +244,7 @@ EOF\n }\n \n script='\n-s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n+s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'`dirname \"$fqgitdir\"`'\";#;\n s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n s#(my|our) \\$projects_list =.*#$1 \\$projects_list = \\$projectroot;#;\n s#(my|our) \\$git_temp =.*#$1 \\$git_temp = \"'$fqgitdir/gitweb/tmp'\";#;'\n-- \n1.5.5.3\n"},{"id":"79575","messageId":"m3r6b3qedj.fsf@localhost.localdomain","threadId":"13907","inReplyTo":"1213235480-21925-1-git-send-email-flavio@polettix.it","subject":"Re: [PATCH] Enhanced auto-discovery of httpd location and call conventions.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-12T07:52:36Z","receivedAt":"2008-06-12T07:52:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Flavio Poletti (polettix)\" <flavio@polettix.it> writes:\n\n> Another minor change is a substitution of a shell sub-call using \"$()\"\n> by means of backticks. In my understanding, plain /bin/sh does not support\n> \"$()\".\n\nBut POSIX shell does.  And git does make use of it rather extensively.\n\nBesides, see Documentation/CodingGuidelines:\n\n  For shell scripts specifically (not exhaustive):\n\n   - We prefer $( ... ) for command substitution; unlike ``, it\n     properly nests.  It should have been the way Bourne spelled\n     it from day one, but unfortunately isn't.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"79580","messageId":"1213264759-5264-1-git-send-email-flavio@polettix.it","threadId":"13907","inReplyTo":"1213235480-21925-1-git-send-email-flavio@polettix.it","subject":"[PATCH v2] git-instaweb: Enhanced auto-discovery of httpd and call conventions. Removed backticks.","fromName":"Flavio Poletti","fromEmail":"flavio@polettix.it","sentAt":"2008-06-12T09:59:19Z","receivedAt":"2008-06-12T09:59:19Z","isPatch":true,"sender":{"key":"flavio@polettix.it","avatar":"https://gravatar.com/avatar/5466f4891265e5b9f386e334a5a1100866c8a74148e8144a49e4ffef735bf22a?d=mp&s=160"},"body":"This patch allows calling:\n\n   git-instaweb -d apache2\n\nand have the script Do The Right Thing. In particular, the auto-discovery\nmechanism has been extended in order to be used for module listing as\nwell, and the call convention is that if the daemon is apache2/lighttpd\nand the parameter to the \"-d\" option does not end by \"-f\", the \"-f\" is\nadded to the end of the option itself.\n\nChanged all backticks to $( ... ) as per Documentation/CodingGuidelines:\n\n   For shell scripts specifically (not exhaustive):\n\n      - We prefer $( ... ) for command substitution; unlike ``, it\n         properly nests.  It should have been the way Bourne spelled\n         it from day one, but unfortunately isn't.\n\nThe rationale is that the POSIX shell does support $( ... ), and git\ndoes make use of it rather extensively. (Thanks to Jakub Narebski for\npointing this out).\n\nSigned-off-by: Flavio Poletti <flavio@polettix.it>\n---\nFollowing Jakub's observation about backticks, I sanitised the whole\nscript to use $( ... ) instead of backticks. I hope that bundling it\nwith the proposed patch can be acceptable in this case; if not, I can\nproduce two different patches and send them separately.\n\nCheers,\n\n   Flavio.\n git-instaweb.sh |   46 +++++++++++++++++++++++++++++++---------------\n 1 files changed, 31 insertions(+), 15 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 6f91c8f..ec22344 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -22,10 +22,10 @@ restart        restart the web server\n . git-sh-setup\n \n fqgitdir=\"$GIT_DIR\"\n-local=\"`git config --bool --get instaweb.local`\"\n-httpd=\"`git config --get instaweb.httpd`\"\n-port=`git config --get instaweb.port`\n-module_path=\"`git config --get instaweb.modulepath`\"\n+local=\"$(git config --bool --get instaweb.local)\"\n+httpd=\"$(git config --get instaweb.httpd)\"\n+port=$(git config --get instaweb.port)\n+module_path=\"$(git config --get instaweb.modulepath)\"\n \n conf=\"$GIT_DIR/gitweb/httpd.conf\"\n \n@@ -37,11 +37,23 @@ test -z \"$httpd\" && httpd='lighttpd -f'\n # any untaken local port will do...\n test -z \"$port\" && port=1234\n \n-start_httpd () {\n-\thttpd_only=\"`echo $httpd | cut -f1 -d' '`\"\n+resolve_httpd () {\n+\tlocal_httpd=$1\n+\n+\tcase \"$local_httpd\" in\n+\t*apache2*|*lighttpd*)\n+\t\t# ensure that the apache2/lighttpd command ends with \"-f\"\n+\t\tif ! echo \"$local_httpd\" | grep -- '-f *$' >/dev/null 2>&1\n+\t\tthen\n+\t\t\tlocal_httpd=\"$local_httpd -f\"\n+\t\tfi\n+\t\t;;\n+\tesac\n+\n+\thttpd_only=\"$(echo $local_httpd | cut -f1 -d' ')\"\n \tif case \"$httpd_only\" in /*) : ;; *) which $httpd_only >/dev/null;; esac\n \tthen\n-\t\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\techo $local_httpd\n \telse\n \t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n \t\t# these days and those are not in most users $PATHs\n@@ -51,16 +63,19 @@ start_httpd () {\n \t\tdo\n \t\t\tif test -x \"$i/$httpd_only\"\n \t\t\tthen\n-\t\t\t\t# don't quote $httpd, there can be\n-\t\t\t\t# arguments to it (-f)\n-\t\t\t\t$i/$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\t\t\techo $i/$local_httpd\n \t\t\t\treturn\n \t\t\tfi\n \t\tdone\n-\t\techo \"$httpd_only not found. Install $httpd_only or use\" \\\n+\t\techo >&2 \"$httpd_only not found. Install $httpd_only or use\" \\\n \t\t     \"--httpd to specify another http daemon.\"\n \t\texit 1\n \tfi\n+}\n+\n+start_httpd () {\n+\t# don't quote $httpd, there can be arguments to it (-f)\n+\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n \tif test $? != 0; then\n \t\techo \"Could not execute http daemon $httpd.\"\n \t\texit 1\n@@ -68,9 +83,10 @@ start_httpd () {\n }\n \n stop_httpd () {\n-\ttest -f \"$fqgitdir/pid\" && kill `cat \"$fqgitdir/pid\"`\n+\ttest -f \"$fqgitdir/pid\" && kill $(cat \"$fqgitdir/pid\")\n }\n \n+httpd=$(resolve_httpd \"$httpd\")\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -92,7 +108,7 @@ do\n \t\t;;\n \t-d|--httpd)\n \t\tshift\n-\t\thttpd=\"$1\"\n+\t\thttpd=$(resolve_httpd \"$1\")\n \t\t;;\n \t-b|--browser)\n \t\tshift\n@@ -116,7 +132,7 @@ do\n done\n \n mkdir -p \"$GIT_DIR/gitweb/tmp\"\n-GIT_EXEC_PATH=\"`git --exec-path`\"\n+GIT_EXEC_PATH=\"$(git --exec-path)\"\n GIT_DIR=\"$fqgitdir\"\n export GIT_EXEC_PATH GIT_DIR\n \n@@ -215,7 +231,7 @@ PerlPassEnv GIT_EXEC_DIR\n EOF\n \telse\n \t\t# plain-old CGI\n-\t\tlist_mods=`echo \"$httpd\" | sed \"s/-f$/-l/\"`\n+\t\tlist_mods=$(echo \"$httpd\" | sed \"s/-f$/-l/\")\n \t\t$list_mods | grep 'mod_cgi\\.c' >/dev/null 2>&1 || \\\n \t\techo \"LoadModule cgi_module $module_path/mod_cgi.so\" >> \"$conf\"\n \t\tcat >> \"$conf\" <<EOF\n-- \n1.5.5.3\n"},{"id":"79644","messageId":"1213307695-2563-1-git-send-email-flavio@polettix.it","threadId":"13907","inReplyTo":"1213264759-5264-1-git-send-email-flavio@polettix.it","subject":"[PATCH v3] git-instaweb: Enhanced auto-discovery of httpd and call conventions. Removed backticks.","fromName":"Flavio Poletti","fromEmail":"flavio@polettix.it","sentAt":"2008-06-12T21:54:55Z","receivedAt":"2008-06-12T21:54:55Z","isPatch":true,"sender":{"key":"flavio@polettix.it","avatar":"https://gravatar.com/avatar/5466f4891265e5b9f386e334a5a1100866c8a74148e8144a49e4ffef735bf22a?d=mp&s=160"},"body":"This patch allows calling:\n\n   git-instaweb -d apache2\n\nand have the script Do The Right Thing. In particular, the auto-discovery\nmechanism has been extended in order to be used for module listing as\nwell, and the call convention is that if the daemon is apache2/lighttpd\nand the parameter to the \"-d\" option does not end by \"-f\", the \"-f\" is\nadded to the end of the option itself.\n\nChanged all backticks to $( ... ) as per Documentation/CodingGuidelines:\n\n   For shell scripts specifically (not exhaustive):\n\n      - We prefer $( ... ) for command substitution; unlike ``, it\n         properly nests.  It should have been the way Bourne spelled\n         it from day one, but unfortunately isn't.\n\nThe rationale is that the POSIX shell does support $( ... ), and git\ndoes make use of it rather extensively. (Thanks to Jakub Narebski for\npointing this out).\n\nSigned-off-by: Flavio Poletti <flavio@polettix.it>\n---\n\nSorry for the traffic, but I noticed that a stray warning was emitted\ndue to a last-second change (which teaches me once more that those\n\"innocent\" last-second it-cannot-spoil-anything changes are the\nmost poisonus snakes in programming.\n\n git-instaweb.sh |   48 +++++++++++++++++++++++++++++++++---------------\n 1 files changed, 33 insertions(+), 15 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 6f91c8f..af0fde5 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -22,10 +22,10 @@ restart        restart the web server\n . git-sh-setup\n \n fqgitdir=\"$GIT_DIR\"\n-local=\"`git config --bool --get instaweb.local`\"\n-httpd=\"`git config --get instaweb.httpd`\"\n-port=`git config --get instaweb.port`\n-module_path=\"`git config --get instaweb.modulepath`\"\n+local=\"$(git config --bool --get instaweb.local)\"\n+httpd=\"$(git config --get instaweb.httpd)\"\n+port=$(git config --get instaweb.port)\n+module_path=\"$(git config --get instaweb.modulepath)\"\n \n conf=\"$GIT_DIR/gitweb/httpd.conf\"\n \n@@ -37,11 +37,21 @@ test -z \"$httpd\" && httpd='lighttpd -f'\n # any untaken local port will do...\n test -z \"$port\" && port=1234\n \n-start_httpd () {\n-\thttpd_only=\"`echo $httpd | cut -f1 -d' '`\"\n+resolve_full_httpd () {\n+\tcase \"$httpd\" in\n+\t*apache2*|*lighttpd*)\n+\t\t# ensure that the apache2/lighttpd command ends with \"-f\"\n+\t\tif ! echo \"$httpd\" | grep -- '-f *$' >/dev/null 2>&1\n+\t\tthen\n+\t\t\thttpd=\"$httpd -f\"\n+\t\tfi\n+\t\t;;\n+\tesac\n+\n+\thttpd_only=\"$(echo $httpd | cut -f1 -d' ')\"\n \tif case \"$httpd_only\" in /*) : ;; *) which $httpd_only >/dev/null;; esac\n \tthen\n-\t\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\tfull_httpd=$httpd\n \telse\n \t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n \t\t# these days and those are not in most users $PATHs\n@@ -51,16 +61,23 @@ start_httpd () {\n \t\tdo\n \t\t\tif test -x \"$i/$httpd_only\"\n \t\t\tthen\n-\t\t\t\t# don't quote $httpd, there can be\n-\t\t\t\t# arguments to it (-f)\n-\t\t\t\t$i/$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\t\t\tfull_httpd=$i/$httpd\n \t\t\t\treturn\n \t\t\tfi\n \t\tdone\n-\t\techo \"$httpd_only not found. Install $httpd_only or use\" \\\n-\t\t     \"--httpd to specify another http daemon.\"\n+\n+\t\techo >&2 \"$httpd_only not found. Install $httpd_only or use\" \\\n+\t\t     \"--httpd to specify another httpd daemon.\"\n \t\texit 1\n \tfi\n+}\n+\n+start_httpd () {\n+\t# here $httpd should have a meaningful value\n+\tresolve_full_httpd\n+\n+\t# don't quote $full_httpd, there can be arguments to it (-f)\n+\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n \tif test $? != 0; then\n \t\techo \"Could not execute http daemon $httpd.\"\n \t\texit 1\n@@ -68,7 +85,7 @@ start_httpd () {\n }\n \n stop_httpd () {\n-\ttest -f \"$fqgitdir/pid\" && kill `cat \"$fqgitdir/pid\"`\n+\ttest -f \"$fqgitdir/pid\" && kill $(cat \"$fqgitdir/pid\")\n }\n \n while test $# != 0\n@@ -116,7 +133,7 @@ do\n done\n \n mkdir -p \"$GIT_DIR/gitweb/tmp\"\n-GIT_EXEC_PATH=\"`git --exec-path`\"\n+GIT_EXEC_PATH=\"$(git --exec-path)\"\n GIT_DIR=\"$fqgitdir\"\n export GIT_EXEC_PATH GIT_DIR\n \n@@ -215,7 +232,8 @@ PerlPassEnv GIT_EXEC_DIR\n EOF\n \telse\n \t\t# plain-old CGI\n-\t\tlist_mods=`echo \"$httpd\" | sed \"s/-f$/-l/\"`\n+\t\tresolve_full_httpd\n+\t\tlist_mods=$(echo \"$full_httpd\" | sed \"s/-f$/-l/\")\n \t\t$list_mods | grep 'mod_cgi\\.c' >/dev/null 2>&1 || \\\n \t\techo \"LoadModule cgi_module $module_path/mod_cgi.so\" >> \"$conf\"\n \t\tcat >> \"$conf\" <<EOF\n-- \n1.5.5.4\n"},{"id":"79742","messageId":"20080613170214.GF5966@yp-box.dyndns.org","threadId":"13907","inReplyTo":"1213307695-2563-1-git-send-email-flavio@polettix.it","subject":"Re: [PATCH v3] git-instaweb: Enhanced auto-discovery of httpd and call conventions. Removed backticks.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-06-13T17:02:14Z","receivedAt":"2008-06-13T17:02:14Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Flavio Poletti <flavio@polettix.it> wrote:\n> This patch allows calling:\n> \n>    git-instaweb -d apache2\n> \n> and have the script Do The Right Thing. In particular, the auto-discovery\n> mechanism has been extended in order to be used for module listing as\n> well, and the call convention is that if the daemon is apache2/lighttpd\n> and the parameter to the \"-d\" option does not end by \"-f\", the \"-f\" is\n> added to the end of the option itself.\n> \n> Changed all backticks to $( ... ) as per Documentation/CodingGuidelines:\n> \n>    For shell scripts specifically (not exhaustive):\n> \n>       - We prefer $( ... ) for command substitution; unlike ``, it\n>          properly nests.  It should have been the way Bourne spelled\n>          it from day one, but unfortunately isn't.\n> \n> The rationale is that the POSIX shell does support $( ... ), and git\n> does make use of it rather extensively. (Thanks to Jakub Narebski for\n> pointing this out).\n> \n> Signed-off-by: Flavio Poletti <flavio@polettix.it>\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n> \n> Sorry for the traffic, but I noticed that a stray warning was emitted\n> due to a last-second change (which teaches me once more that those\n> \"innocent\" last-second it-cannot-spoil-anything changes are the\n> most poisonus snakes in programming.\n> \n>  git-instaweb.sh |   48 +++++++++++++++++++++++++++++++++---------------\n>  1 files changed, 33 insertions(+), 15 deletions(-)\n> \n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index 6f91c8f..af0fde5 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -22,10 +22,10 @@ restart        restart the web server\n>  . git-sh-setup\n>  \n>  fqgitdir=\"$GIT_DIR\"\n> -local=\"`git config --bool --get instaweb.local`\"\n> -httpd=\"`git config --get instaweb.httpd`\"\n> -port=`git config --get instaweb.port`\n> -module_path=\"`git config --get instaweb.modulepath`\"\n> +local=\"$(git config --bool --get instaweb.local)\"\n> +httpd=\"$(git config --get instaweb.httpd)\"\n> +port=$(git config --get instaweb.port)\n> +module_path=\"$(git config --get instaweb.modulepath)\"\n>  \n>  conf=\"$GIT_DIR/gitweb/httpd.conf\"\n>  \n> @@ -37,11 +37,21 @@ test -z \"$httpd\" && httpd='lighttpd -f'\n>  # any untaken local port will do...\n>  test -z \"$port\" && port=1234\n>  \n> -start_httpd () {\n> -\thttpd_only=\"`echo $httpd | cut -f1 -d' '`\"\n> +resolve_full_httpd () {\n> +\tcase \"$httpd\" in\n> +\t*apache2*|*lighttpd*)\n> +\t\t# ensure that the apache2/lighttpd command ends with \"-f\"\n> +\t\tif ! echo \"$httpd\" | grep -- '-f *$' >/dev/null 2>&1\n> +\t\tthen\n> +\t\t\thttpd=\"$httpd -f\"\n> +\t\tfi\n> +\t\t;;\n> +\tesac\n> +\n> +\thttpd_only=\"$(echo $httpd | cut -f1 -d' ')\"\n>  \tif case \"$httpd_only\" in /*) : ;; *) which $httpd_only >/dev/null;; esac\n>  \tthen\n> -\t\t$httpd \"$fqgitdir/gitweb/httpd.conf\"\n> +\t\tfull_httpd=$httpd\n>  \telse\n>  \t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n>  \t\t# these days and those are not in most users $PATHs\n> @@ -51,16 +61,23 @@ start_httpd () {\n>  \t\tdo\n>  \t\t\tif test -x \"$i/$httpd_only\"\n>  \t\t\tthen\n> -\t\t\t\t# don't quote $httpd, there can be\n> -\t\t\t\t# arguments to it (-f)\n> -\t\t\t\t$i/$httpd \"$fqgitdir/gitweb/httpd.conf\"\n> +\t\t\t\tfull_httpd=$i/$httpd\n>  \t\t\t\treturn\n>  \t\t\tfi\n>  \t\tdone\n> -\t\techo \"$httpd_only not found. Install $httpd_only or use\" \\\n> -\t\t     \"--httpd to specify another http daemon.\"\n> +\n> +\t\techo >&2 \"$httpd_only not found. Install $httpd_only or use\" \\\n> +\t\t     \"--httpd to specify another httpd daemon.\"\n>  \t\texit 1\n>  \tfi\n> +}\n> +\n> +start_httpd () {\n> +\t# here $httpd should have a meaningful value\n> +\tresolve_full_httpd\n> +\n> +\t# don't quote $full_httpd, there can be arguments to it (-f)\n> +\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n>  \tif test $? != 0; then\n>  \t\techo \"Could not execute http daemon $httpd.\"\n>  \t\texit 1\n> @@ -68,7 +85,7 @@ start_httpd () {\n>  }\n>  \n>  stop_httpd () {\n> -\ttest -f \"$fqgitdir/pid\" && kill `cat \"$fqgitdir/pid\"`\n> +\ttest -f \"$fqgitdir/pid\" && kill $(cat \"$fqgitdir/pid\")\n>  }\n>  \n>  while test $# != 0\n> @@ -116,7 +133,7 @@ do\n>  done\n>  \n>  mkdir -p \"$GIT_DIR/gitweb/tmp\"\n> -GIT_EXEC_PATH=\"`git --exec-path`\"\n> +GIT_EXEC_PATH=\"$(git --exec-path)\"\n>  GIT_DIR=\"$fqgitdir\"\n>  export GIT_EXEC_PATH GIT_DIR\n>  \n> @@ -215,7 +232,8 @@ PerlPassEnv GIT_EXEC_DIR\n>  EOF\n>  \telse\n>  \t\t# plain-old CGI\n> -\t\tlist_mods=`echo \"$httpd\" | sed \"s/-f$/-l/\"`\n> +\t\tresolve_full_httpd\n> +\t\tlist_mods=$(echo \"$full_httpd\" | sed \"s/-f$/-l/\")\n>  \t\t$list_mods | grep 'mod_cgi\\.c' >/dev/null 2>&1 || \\\n>  \t\techo \"LoadModule cgi_module $module_path/mod_cgi.so\" >> \"$conf\"\n>  \t\tcat >> \"$conf\" <<EOF\n> -- \n> 1.5.5.4\n> \n"}]}