git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] instaweb: if no httpd is specified and lighttpd doesn't exist, fall back on apache2.

From
nathan spindel <nathans@gmail.com>
Date
May 11, 2008, 17:00 UTC
Message-ID
<0EB126FA-6752-4C66-B93D-48694159E3B6@gmail.com>
In-Reply-To
<7vlk2h7318.fsf@gitster.siamese.dyndns.org>
On May 10, 2008, at 11:44 PM, Junio C Hamano wrote:
Show 37 quoted lines
> nathan spindel <nathans@gmail.com> writes:
>
>> Signed-off-by: nathan spindel <nathans@gmail.com>
>> ---
>> git-instaweb.sh |   12 ++++++++++--
>> 1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-instaweb.sh b/git-instaweb.sh
>> index 6f91c8f..b744133 100755
>> --- a/git-instaweb.sh
>> +++ b/git-instaweb.sh
>> @@ -31,8 +31,16 @@ conf="$GIT_DIR/gitweb/httpd.conf"
>>
>> # Defaults:
>>
>> -# if installed, it doesn't need further configuration (module_path)
>> -test -z "$httpd" && httpd='lighttpd -f'
>> +# use lighttpd if it exists, otherwise use apache2
>> +if test -z "$httpd"
>> +then
>> +	if type "lighttpd" > /dev/null 2>&1;
>
> The exit code from "type" is very loosely defined by POSIX which  
> just says
> it exits >0 to signal that "an error occured".  Presumably it means  
> there
> is no such command that is executable on the $PATH, and it may be more
> portable and reliable than using "which", but this still worries me.
>
> Doesn't "lighttpd" have an option that reports "I am here" and exit 0,
> e.g. "--version"?  Then we could instead say:
>
> 	if lighttpd --version >/dev/null
>        then
>        	... use it ...
>
> and that would be much nicer...

I didn't know that the portability of "type" was questionable. That's a good idea. Thanks!

Previous: Junio C HamanoNext: nathan spindel
Message 7 of 11 in “instaweb: if no httpd is specified and lighttpd doesn't exist, fall back on apache2.”
  1. instaweb: if no httpd is specified and lighttpd doesn't exist, fall back on apache2.nathan spindel, May 11, 2008
  2. instaweb: make it compatible with Mac OS X 10.5's apache installation.nathan spindel, May 11, 2008
  3. Documentation/git-instaweb.txt: Updated defaults to match my last two git-instaweb.sh changesnathan spindel, May 11, 2008
  4. Junio C HamanoMay 11, 2008
  5. nathan spindelMay 11, 2008
  6. Junio C HamanoMay 11, 2008
  7. nathan spindelMay 11, 2008
  8. nathan spindelMay 11, 2008
  9. David SymondsMay 11, 2008
  10. nathan spindelMay 11, 2008
  11. Junio C HamanoMay 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.