git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-instaweb portability issue (maybe?)
@ 2008-06-13 13:26 Denis Bueno
  2008-06-13 13:38 ` Denis Bueno
  2008-06-13 14:22 ` Jakub Narebski
  0 siblings, 2 replies; 14+ messages in thread
From: Denis Bueno @ 2008-06-13 13:26 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I'm on OS X 10.4.11 on Intel using git 1.5.5.3.

I'd been trying to use the git-instaweb script (both with and without
arguments) with lighttpd (which I installed through Macports) without
success, seeing the following kind of bizarre error message:

    funsat[290] > git instaweb
    /opt/local/bin/git-instaweb: line 6033: /usr/bin/env perl: No such
file or directory
    2008-06-13 09:09:31: (log.c.75) server started

    funsat[291] > 2008-06-13 09:09:31: (mod_cgi.c.998) CGI failed:
Exec format error /Volumes/work/funsat/.git/gitweb/gitweb.cgi
    mod_cgi.c.1001: aborted
    2008-06-13 09:09:31: (mod_cgi.c.584) cgi died, pid: 23237

"/usr/bin/env perl: No such file or directory"? Huh?  I certainly have
perl installed, so I don't know what that's about.

That line simply calls perl by the $PERL variable, which is set at the
top of the script, like so:

    PERL='/usr/bin/env perl'

If I change this line to point to my perl directly, it works.  On a
hunch, I changed it to:

    PERL="/usr/bin/env perl"  # note the double-quotes

And now it works.  Could this be changed for future releases of git?
Does this in fact increase portability, or is something more sinister
going on?

Thanks.

-- 
 Denis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:26 git-instaweb portability issue (maybe?) Denis Bueno
@ 2008-06-13 13:38 ` Denis Bueno
  2008-06-13 13:46   ` Asheesh Laroia
  2008-06-13 14:21   ` Luciano Rocha
  2008-06-13 14:22 ` Jakub Narebski
  1 sibling, 2 replies; 14+ messages in thread
From: Denis Bueno @ 2008-06-13 13:38 UTC (permalink / raw)
  To: Git Mailing List

On Fri, Jun 13, 2008 at 09:26, Denis Bueno <dbueno@gmail.com> wrote:
> That line simply calls perl by the $PERL variable, which is set at the
> top of the script, like so:
>
>    PERL='/usr/bin/env perl'
>
> If I change this line to point to my perl directly, it works.  On a
> hunch, I changed it to:
>
>    PERL="/usr/bin/env perl"  # note the double-quotes

[snip lies]

Apparently I didn't test this thoroughly enough, and I was wrong.
Changing the quotes has no effect.

So git-instaweb only works for me if I manually specify my perl path.
Can anyone think of why this might be?

-- 
 Denis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:38 ` Denis Bueno
@ 2008-06-13 13:46   ` Asheesh Laroia
  2008-06-13 13:59     ` Denis Bueno
  2008-06-13 14:21   ` Luciano Rocha
  1 sibling, 1 reply; 14+ messages in thread
From: Asheesh Laroia @ 2008-06-13 13:46 UTC (permalink / raw)
  To: Denis Bueno; +Cc: Git Mailing List

On Fri, 13 Jun 2008, Denis Bueno wrote:

> On Fri, Jun 13, 2008 at 09:26, Denis Bueno <dbueno@gmail.com> wrote:
>> That line simply calls perl by the $PERL variable, which is set at the
>> top of the script, like so:
>>
>>    PERL='/usr/bin/env perl'
>>
>> If I change this line to point to my perl directly, it works.  On a
>> hunch, I changed it to:
>>
>>    PERL="/usr/bin/env perl"  # note the double-quotes
>
> [snip lies]
>
> Apparently I didn't test this thoroughly enough, and I was wrong.
> Changing the quotes has no effect.
>
> So git-instaweb only works for me if I manually specify my perl path.
> Can anyone think of why this might be?

Does OS X ship /usr/bin/env?

If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?

-- Asheesh.

-- 
Hark ye, Clinker, you are a most notorious offender.  You stand convicted of
sickness, hunger, wretchedness, and want.
 		-- Tobias Smollet

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:46   ` Asheesh Laroia
@ 2008-06-13 13:59     ` Denis Bueno
  2008-06-13 14:10       ` Chris Ridd
  0 siblings, 1 reply; 14+ messages in thread
From: Denis Bueno @ 2008-06-13 13:59 UTC (permalink / raw)
  To: Asheesh Laroia; +Cc: Git Mailing List

On Fri, Jun 13, 2008 at 09:46, Asheesh Laroia <asheesh@asheesh.org> wrote:
> Does OS X ship /usr/bin/env?
>
> If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?

Sorry, I should have made that clear earlier: yes.

funsat[122] > /usr/bin/env perl --version

This is perl, v5.8.8 built for darwin-2level


-- 
 Denis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:59     ` Denis Bueno
@ 2008-06-13 14:10       ` Chris Ridd
  2008-06-13 14:16         ` Asheesh Laroia
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Ridd @ 2008-06-13 14:10 UTC (permalink / raw)
  To: Git Mailing List

Denis Bueno wrote:
> On Fri, Jun 13, 2008 at 09:46, Asheesh Laroia <asheesh@asheesh.org> wrote:
>> Does OS X ship /usr/bin/env?
>>
>> If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?
> 
> Sorry, I should have made that clear earlier: yes.
> 
> funsat[122] > /usr/bin/env perl --version
> 
> This is perl, v5.8.8 built for darwin-2level

MacPorts /tends/ to make ports use stuff from other ports instead of 
using Apple-installed bits. In this case, maybe git from MacPorts is 
using perl from MacPorts?

Cheers,

Chris

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 14:10       ` Chris Ridd
@ 2008-06-13 14:16         ` Asheesh Laroia
  2008-06-13 14:42           ` Chris Ridd
  0 siblings, 1 reply; 14+ messages in thread
From: Asheesh Laroia @ 2008-06-13 14:16 UTC (permalink / raw)
  To: Git Mailing List

On Fri, 13 Jun 2008, Chris Ridd wrote:

> Denis Bueno wrote:
>> On Fri, Jun 13, 2008 at 09:46, Asheesh Laroia <asheesh@asheesh.org> wrote:
>>> Does OS X ship /usr/bin/env?
>>> 
>>> If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?
>> 
>> Sorry, I should have made that clear earlier: yes.
>> 
>> funsat[122] > /usr/bin/env perl --version
>> 
>> This is perl, v5.8.8 built for darwin-2level
>
> MacPorts /tends/ to make ports use stuff from other ports instead of using 
> Apple-installed bits. In this case, maybe git from MacPorts is using perl 
> from MacPorts?

FWIW, the problem seems to be that it's not finding *any* Perl.

-- Asheesh.

-- 
A can of ASPARAGUS, 73 pigeons, some LIVE ammo, and a FROZEN DAQUIRI!!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:38 ` Denis Bueno
  2008-06-13 13:46   ` Asheesh Laroia
@ 2008-06-13 14:21   ` Luciano Rocha
  2008-06-13 14:39     ` Denis Bueno
  1 sibling, 1 reply; 14+ messages in thread
From: Luciano Rocha @ 2008-06-13 14:21 UTC (permalink / raw)
  To: Denis Bueno; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

On Fri, Jun 13, 2008 at 09:38:18AM -0400, Denis Bueno wrote:
> On Fri, Jun 13, 2008 at 09:26, Denis Bueno <dbueno@gmail.com> wrote:
> > That line simply calls perl by the $PERL variable, which is set at the
> > top of the script, like so:
> >
> >    PERL='/usr/bin/env perl'
> >
> > If I change this line to point to my perl directly, it works.  On a
> > hunch, I changed it to:
> >
> >    PERL="/usr/bin/env perl"  # note the double-quotes
> 
> [snip lies]
> 
> Apparently I didn't test this thoroughly enough, and I was wrong.
> Changing the quotes has no effect.

That makes more sense.

Try changing the following line instead:
	"$PERL" -p -e "$script" "$1.tmp"  > "$1"
to
	$PERL -p -e "$script" "$1.tmp"  > "$1"

about line 6121 of the git-instaweb script.

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 13:26 git-instaweb portability issue (maybe?) Denis Bueno
  2008-06-13 13:38 ` Denis Bueno
@ 2008-06-13 14:22 ` Jakub Narebski
  1 sibling, 0 replies; 14+ messages in thread
From: Jakub Narebski @ 2008-06-13 14:22 UTC (permalink / raw)
  To: Denis Bueno; +Cc: Git Mailing List

"Denis Bueno" <dbueno@gmail.com> writes:

> I'm on OS X 10.4.11 on Intel using git 1.5.5.3.
> 
> I'd been trying to use the git-instaweb script (both with and without
> arguments) with lighttpd (which I installed through Macports) without
> success, seeing the following kind of bizarre error message:
> 
>     funsat[290] > git instaweb
>     /opt/local/bin/git-instaweb: line 6033: /usr/bin/env perl: No such
> file or directory
>     2008-06-13 09:09:31: (log.c.75) server started
> 
>     funsat[291] > 2008-06-13 09:09:31: (mod_cgi.c.998) CGI failed:
> Exec format error /Volumes/work/funsat/.git/gitweb/gitweb.cgi
>     mod_cgi.c.1001: aborted
>     2008-06-13 09:09:31: (mod_cgi.c.584) cgi died, pid: 23237
> 
> "/usr/bin/env perl: No such file or directory"? Huh?  I certainly have
> perl installed, so I don't know what that's about.
> 
> That line simply calls perl by the $PERL variable, which is set at the
> top of the script, like so:
> 
>     PERL='/usr/bin/env perl'

This depends on how git was build (on compile time configuration).
git-instaweb.sh (source of git-instaweb) has

        PERL='@@PERL@@'

which is set to value of $PERL_PATH (or, to be more exact, its squoted
version) during building git-instaweb.  So you can simply use

  $ make PERL_PATH=/usr/bin/perl
  # make PERL_PATH=/usr/bin/perl install

or whatever, or you can use ./configure script

  $ make configure
  $ ./configure --with-perl=/usr/bin/perl


On Linux for example the path to perl is set explicitely, instead of
using "/usr/bin/env perl" construct.  The 'env' construct has the
following disadvantages:
 - it uses first Perl find in your $PATH, so if git works for you or
   don't work depends on user's personal configuration
   (reproductability, convenience and security).
 - AFAIK it doesn't allow to pass switches to Perl


P.S. Check if you have new enough Perl (there are problems with
Unicode support in old Perl), and if you have CGI.pm new enough
installed for gitweb.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 14:21   ` Luciano Rocha
@ 2008-06-13 14:39     ` Denis Bueno
  2008-06-13 15:13       ` Luciano Rocha
  0 siblings, 1 reply; 14+ messages in thread
From: Denis Bueno @ 2008-06-13 14:39 UTC (permalink / raw)
  To: Luciano Rocha; +Cc: Git Mailing List

On Fri, Jun 13, 2008 at 10:21, Luciano Rocha <luciano@eurotux.com> wrote:
> Try changing the following line instead:
>        "$PERL" -p -e "$script" "$1.tmp"  > "$1"
> to
>        $PERL -p -e "$script" "$1.tmp"  > "$1"
>
> about line 6121 of the git-instaweb script.

This is line 6033 for me; however, this change makes it work!  (I
verified my changing this line; trying it; then changing it back to
the double-quotes version, and verifying it breaks.)

Why?

-- 
 Denis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 14:16         ` Asheesh Laroia
@ 2008-06-13 14:42           ` Chris Ridd
  2008-06-13 14:47             ` Denis Bueno
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Ridd @ 2008-06-13 14:42 UTC (permalink / raw)
  To: Git Mailing List

Asheesh Laroia wrote:
> On Fri, 13 Jun 2008, Chris Ridd wrote:
> 
>> Denis Bueno wrote:
>>> On Fri, Jun 13, 2008 at 09:46, Asheesh Laroia <asheesh@asheesh.org> 
>>> wrote:
>>>> Does OS X ship /usr/bin/env?
>>>>
>>>> If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?
>>>
>>> Sorry, I should have made that clear earlier: yes.
>>>
>>> funsat[122] > /usr/bin/env perl --version
>>>
>>> This is perl, v5.8.8 built for darwin-2level
>>
>> MacPorts /tends/ to make ports use stuff from other ports instead of 
>> using Apple-installed bits. In this case, maybe git from MacPorts is 
>> using perl from MacPorts?
> 
> FWIW, the problem seems to be that it's not finding *any* Perl.

That's odd, because the Portfile for git-core (1.5.5.3_0) does the 
build, test and destroot install setting:

PERL_PATH="/usr/bin/env perl" NO_FINK=1 NO_DARWIN_PORTS=1

(and some other stuff). Have you pinged the port maintainer 
(bryan@larsen.st)?

Cheers,

Chris

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 14:42           ` Chris Ridd
@ 2008-06-13 14:47             ` Denis Bueno
  0 siblings, 0 replies; 14+ messages in thread
From: Denis Bueno @ 2008-06-13 14:47 UTC (permalink / raw)
  To: Chris Ridd; +Cc: Git Mailing List

On Fri, Jun 13, 2008 at 10:42, Chris Ridd <chris.ridd@isode.com> wrote:
> Asheesh Laroia wrote:
>>
>> On Fri, 13 Jun 2008, Chris Ridd wrote:
>>
>>> Denis Bueno wrote:
>>>>
>>>> On Fri, Jun 13, 2008 at 09:46, Asheesh Laroia <asheesh@asheesh.org>
>>>> wrote:
>>>>>
>>>>> Does OS X ship /usr/bin/env?
>>>>>
>>>>> If you type "/usr/bin/env perl" in a Terminal window, do you get Perl?
>>>>
>>>> Sorry, I should have made that clear earlier: yes.
>>>>
>>>> funsat[122] > /usr/bin/env perl --version
>>>>
>>>> This is perl, v5.8.8 built for darwin-2level
>>>
>>> MacPorts /tends/ to make ports use stuff from other ports instead of
>>> using Apple-installed bits. In this case, maybe git from MacPorts is using
>>> perl from MacPorts?
>>
>> FWIW, the problem seems to be that it's not finding *any* Perl.
>
> That's odd, because the Portfile for git-core (1.5.5.3_0) does the build,
> test and destroot install setting:
>
> PERL_PATH="/usr/bin/env perl" NO_FINK=1 NO_DARWIN_PORTS=1
>
> (and some other stuff). Have you pinged the port maintainer
> (bryan@larsen.st)?

The issue seems to be one of the way bash is treating quotes.  It
apparently is trying to find the *command* "/usr/bin/env perl" and not
executing the command "/usr/bin/env" with a first argument of "perl".

See my message to Luciano moments ago.

-- 
 Denis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 14:39     ` Denis Bueno
@ 2008-06-13 15:13       ` Luciano Rocha
  2008-06-13 15:32         ` Jakub Narebski
  0 siblings, 1 reply; 14+ messages in thread
From: Luciano Rocha @ 2008-06-13 15:13 UTC (permalink / raw)
  To: Denis Bueno; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

On Fri, Jun 13, 2008 at 10:39:11AM -0400, Denis Bueno wrote:
> On Fri, Jun 13, 2008 at 10:21, Luciano Rocha <luciano@eurotux.com> wrote:
> > Try changing the following line instead:
> >        "$PERL" -p -e "$script" "$1.tmp"  > "$1"
> > to
> >        $PERL -p -e "$script" "$1.tmp"  > "$1"
> >
> > about line 6121 of the git-instaweb script.
> 
> This is line 6033 for me; however, this change makes it work!  (I
> verified my changing this line; trying it; then changing it back to
> the double-quotes version, and verifying it breaks.)
> 
> Why?

"$PERL" means the content of the variable is used as the command to
execute.

$PERL, on the other hand, goes through a round of word splitting, that
in your case results in the command "/usr/bin/env", with the arguments
"perl", "-p", ...

Thus, if it is possible to use /usr/bin/env, the current "$PERL"
incantation is incorrect.

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 15:13       ` Luciano Rocha
@ 2008-06-13 15:32         ` Jakub Narebski
  2008-06-13 15:39           ` Luciano Rocha
  0 siblings, 1 reply; 14+ messages in thread
From: Jakub Narebski @ 2008-06-13 15:32 UTC (permalink / raw)
  To: Luciano Rocha; +Cc: Denis Bueno, Git Mailing List

Luciano Rocha <luciano@eurotux.com> writes:
> On Fri, Jun 13, 2008 at 10:39:11AM -0400, Denis Bueno wrote:
>> On Fri, Jun 13, 2008 at 10:21, Luciano Rocha <luciano@eurotux.com> wrote:
>>>
>>> Try changing the following line instead:
>>>        "$PERL" -p -e "$script" "$1.tmp" > "$1"
>>> to
>>>        $PERL -p -e "$script" "$1.tmp" > "$1"
>>>
>>> about line 6121 of the git-instaweb script.
>> 
>> This is line 6033 for me; however, this change makes it work!  (I
>> verified my changing this line; trying it; then changing it back to
>> the double-quotes version, and verifying it breaks.)
>> 
>> Why?
> 
> "$PERL" means the content of the variable is used as the command to
> execute.
> 
> $PERL, on the other hand, goes through a round of word splitting, that
> in your case results in the command "/usr/bin/env", with the arguments
> "perl", "-p", ...
> 
> Thus, if it is possible to use /usr/bin/env, the current "$PERL"
> incantation is incorrect.

The problem is with trying to ensure that both

   /path/with spaces/perl

and

   /usr/bin/env perl

work, as they require different rules wrt. splitting on whitespace...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-instaweb portability issue (maybe?)
  2008-06-13 15:32         ` Jakub Narebski
@ 2008-06-13 15:39           ` Luciano Rocha
  0 siblings, 0 replies; 14+ messages in thread
From: Luciano Rocha @ 2008-06-13 15:39 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Denis Bueno, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

On Fri, Jun 13, 2008 at 08:32:20AM -0700, Jakub Narebski wrote:
> Luciano Rocha <luciano@eurotux.com> writes:
> > On Fri, Jun 13, 2008 at 10:39:11AM -0400, Denis Bueno wrote:
> >> On Fri, Jun 13, 2008 at 10:21, Luciano Rocha <luciano@eurotux.com> wrote:
> >>>
> >>> Try changing the following line instead:
> >>>        "$PERL" -p -e "$script" "$1.tmp" > "$1"
> >>> to
> >>>        $PERL -p -e "$script" "$1.tmp" > "$1"
> >>>
> >>> about line 6121 of the git-instaweb script.
> >> 
> >> This is line 6033 for me; however, this change makes it work!  (I
> >> verified my changing this line; trying it; then changing it back to
> >> the double-quotes version, and verifying it breaks.)
> >> 
> >> Why?
> > 
> > "$PERL" means the content of the variable is used as the command to
> > execute.
> > 
> > $PERL, on the other hand, goes through a round of word splitting, that
> > in your case results in the command "/usr/bin/env", with the arguments
> > "perl", "-p", ...
> > 
> > Thus, if it is possible to use /usr/bin/env, the current "$PERL"
> > incantation is incorrect.
> 
> The problem is with trying to ensure that both
> 
>    /path/with spaces/perl
> 
> and
> 
>    /usr/bin/env perl
> 
> work, as they require different rules wrt. splitting on whitespace...

Oh. Then it gets ugly. Can't just "perl" be used? Instead of
"/usr/bin/env perl"?

Otherwise...
if [ -x "$PERL" ]; then
	"$PERL" ...
else
	$PERL ...
fi

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-06-13 15:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 13:26 git-instaweb portability issue (maybe?) Denis Bueno
2008-06-13 13:38 ` Denis Bueno
2008-06-13 13:46   ` Asheesh Laroia
2008-06-13 13:59     ` Denis Bueno
2008-06-13 14:10       ` Chris Ridd
2008-06-13 14:16         ` Asheesh Laroia
2008-06-13 14:42           ` Chris Ridd
2008-06-13 14:47             ` Denis Bueno
2008-06-13 14:21   ` Luciano Rocha
2008-06-13 14:39     ` Denis Bueno
2008-06-13 15:13       ` Luciano Rocha
2008-06-13 15:32         ` Jakub Narebski
2008-06-13 15:39           ` Luciano Rocha
2008-06-13 14:22 ` Jakub Narebski

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).