threads / discuss / 5587

gitweb on OpenBSD (-T not supported on filesystems...)

Subject: gitweb on OpenBSD (-T not supported on filesystems...)

## tl;dr

5 messages between Sep 17, 2006 and Sep 17, 2006.

replies: 4people: 3as markdown or json

Andrew Pamment· Sep 17, 2006, 08:45 UTC · lore
Hi git people
I'm not sure if this is useful but I thought I would post it anyway,

in gitweb.cgi on line 1560 where you have -T testing a file descripter, it doesn't work on OpenBSD 3.9, which makes viewing blobs not work.

I solved this (or I think I have) by replacing $fd with $filename.
Andrew
-- 
Mort - http://www.mort-os.com/
Jakub Narebski· Sep 17, 2006, 09:12 UTC · re: Andrew Pamment · lore

Re: gitweb on OpenBSD (-T not supported on filesystems...)

Andrew Pamment wrote:
Show 6 quoted lines
> I'm not sure if this is useful but I thought I would post it anyway,
> 
> in gitweb.cgi on line 1560 where you have -T testing a file descripter, it  
> doesn't work on OpenBSD 3.9, which makes viewing blobs not work.
> 
> I solved this (or I think I have) by replacing $fd with $filename.

This doesn't work. $filename is file name relative to the git repository, i.e. full path would be $projectroot/$project/../$file_name _if_ the repository is full repository and not bare repository, and when projects are symlinked .. goes up linked directory.

We need '-T $fd', where $fd is open pipe from git-cat-file, to avoid creating temporary files (we just removed need for $tmp_dir and temporary files for creating diffs).

What Perl version do you use? Does 'perldoc -f -X' has the following lines?
        -X FILEHANDLE
        (...) If "-T" or "-B" is used on a filehandle, the current IO buffer
        is examined rather than the first block. (...)
The solution for you would be to skip -T test.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Andrew Pamment· Sep 17, 2006, 09:46 UTC · re: Jakub Narebski · lore

Re: gitweb on OpenBSD (-T not supported on filesystems...)

On Sun, 17 Sep 2006 18:42:12 +0930, Jakub Narebski <jnareb@gmail.com> wrote:

Show 8 quoted lines
> What Perl version do you use? Does 'perldoc -f -X' has the following  
> lines?
>
>         -X FILEHANDLE
>
>         (...) If "-T" or "-B" is used on a filehandle, the current IO  
> buffer
>         is examined rather than the first block. (...)
The version of perl is the one that comes with OpenBSD 3.9, it is v5.8.6.

I do get the above text when I run 'perldoc -f -X', does this mean it should work? When I try the original -T $fd I get:

Software error: -T and -B not implemented on filehandles at /var/www/htdocs/git/gitweb.cgi line 1598.

> The solution for you would be to skip -T test.
That works fine. Thanks.
Andrew
-- 
Mort - http://www.mort-os.com/
Jakub Narebski· Sep 17, 2006, 09:51 UTC · re: Andrew Pamment · lore

Re: gitweb on OpenBSD (-T not supported on filesystems...)

Andrew Pamment wrote:
Show 16 quoted lines
> On Sun, 17 Sep 2006 18:42:12 +0930, Jakub Narebski <jnareb@gmail.com>  
> wrote:
> 
>> What Perl version do you use? Does 'perldoc -f -X' has the following  
>> lines?
>>
>>         -X FILEHANDLE
>>
>>         (...) If "-T" or "-B" is used on a filehandle, the current IO  
>> buffer
>>         is examined rather than the first block. (...)
> 
> The version of perl is the one that comes with OpenBSD 3.9, it is v5.8.6.
> 
> I do get the above text when I run 'perldoc -f -X', does this mean it  
> should work? 

I thought that OpenBSD has perhaps distributed some old Perl version that doesn't have -X tests (including -T/-B) on filehandles.

Show 5 quoted lines
> When I try the original -T $fd I get: 
> 
> Software error:
> -T and -B not implemented on filehandles at /var/www/htdocs/git/gitweb.cgi  
> line 1598.
So this means that Perl implementation in OpenBSD is flawed.

Does anyone else has problem with gitweb on other systems? (I guess that gitweb doesn't work with ActivePerl).

>> The solution for you would be to skip -T test.
> 
> That works fine. Thanks.

The -T test is just a fallback for when we cannot derive mimetype. I don't know if you should default to 'application/octet-stream' or 'text/plain' in your case; that perhaps depends on the repository.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Randal L. Schwartz· Sep 17, 2006, 15:07 UTC · re: Jakub Narebski · lore

Re: gitweb on OpenBSD (-T not supported on filesystems...)

>>>>> "Jakub" == Jakub Narebski <jnareb@gmail.com> writes:

Jakub> I thought that OpenBSD has perhaps distributed some old Perl version that Jakub> doesn't have -X tests (including -T/-B) on filehandles.

Show 5 quoted lines
>> When I try the original -T $fd I get: 
>> 
>> Software error:
>> -T and -B not implemented on filehandles at /var/www/htdocs/git/gitweb.cgi  
>> line 1598.
Jakub> So this means that Perl implementation in OpenBSD is flawed.
No, see "perldoc perldiag":
       "-T" and "-B" not implemented on filehandles
           (F) Perl can't peek at the stdio buffer of filehandles when it
           doesn't know about your kind of stdio.  You'll have to use a file-
           name instead.

So the problem is that OpenBSD has a stdio that is not what the Perl authors anticipated, because it requires peeking behind official interfaces. Perl isn't flawed. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

← back to recent threads