git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: nathan spindel <nathans@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Christian Couder <chriscool@tuxfamily.org>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] instaweb: make it compatible with Mac OS X 10.5's apache installation.
Date: Tue, 13 May 2008 05:30:19 -0700 (PDT)	[thread overview]
Message-ID: <m37idy5qvz.fsf@localhost.localdomain> (raw)
In-Reply-To: <21CA1226-223D-4347-A119-1D5A2CEA003E@gmail.com>

nathan spindel <nathans@gmail.com> writes:

> On May 12, 2008, at 11:42 AM, Junio C Hamano wrote:
> 
>> Christian Couder <chriscool@tuxfamily.org> writes:
>>
>>> Maybe you can use a function like this not tested one:
>>>
>>> check_cmd() {
>>> 	cmd="$1"
>>>
>>> 	if type "$cmd"> /dev/null 2>&1; then
>>> 		if "$cmd" -v | grep Apache> /dev/null 2>&1; then
>>> 			httpd=$(echo "$cmd" | sed "s/apache2/httpd/")
>>> 		fi
>>> 	fi
>>> }
>>
>> One worry I have with that approach is if any and all random
>> implementations of "httpd" that live somewhere in path do not do
>> any harm when started with "-v" option.  Namely, they should exit
>> without becoming a daemon and/or start the service.
>>
>> I am not convinced that would be the case.

By the way, it is a bit strange that Apache doesn't understand long
equivalent of -v, namely --version.

> I agree with that worry. Solving that in the general case is pretty
> difficult, so I think we could instead look for other clues in the
> system. Some ideas:
> 
> - Use $HTTPD as defined in apachectl. (How portable is that?)

You mean what apachectl returns in Usage: (first line)?

  1014:jnareb@roke:~> /usr/sbin/apachectl          
  Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]

> - Inspect the text of 'man httpd' to determine if it's Apache or not.

Manpages might be not installed.  I think 'httpd -v' is less error
prone...

> - Only fallback on the httpd command on Mac OS X 10.5? That's pretty
> safe.

Not only MacOS X has Apache installed as httpd binary.  Some Linux
distributions do that too.


P.S. I wonder if it would be possible, as absolutely last resort
fallback, to make git-instaweb to create/use very simple web server in
Perl, using HTTP::Daemon module (if it is installed), which comes from
libwww-perl.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

      reply	other threads:[~2008-05-13 12:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11 19:36 [PATCH v2] instaweb: make it compatible with Mac OS X 10.5's apache installation nathan spindel
2008-05-11 19:41 ` nathan spindel
2008-05-12 17:52   ` Christian Couder
2008-05-12 18:42     ` Junio C Hamano
2008-05-13  2:54       ` nathan spindel
2008-05-13 12:30         ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37idy5qvz.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nathans@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).