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

5 messages from 2006-09-17 to 2006-09-17. Participants: Andrew Pamment, Jakub Narebski, Randal L. Schwartz.
Thread: https://gitlist.dev/t/5587

## Andrew Pamment, 2006-09-17 08:45

Subject: gitweb on OpenBSD (-T not supported on filesystems...)
Message-ID: <op.tf0k9fdvqpav6l@crystal.sienna.ath.cx>
URL: https://gitlist.dev/e/op.tf0k9fdvqpav6l%40crystal.sienna.ath.cx

```
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, 2006-09-17 09:12

Subject: Re: gitweb on OpenBSD (-T not supported on filesystems...)
Message-ID: <eej3g3$d9j$1@sea.gmane.org>
URL: https://gitlist.dev/e/eej3g3%24d9j%241%40sea.gmane.org
In-Reply-To: <op.tf0k9fdvqpav6l@crystal.sienna.ath.cx>

```
Andrew Pamment wrote:

> 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, 2006-09-17 09:46

Subject: Re: gitweb on OpenBSD (-T not supported on filesystems...)
Message-ID: <op.tf0n3bjjqpav6l@crystal.sienna.ath.cx>
URL: https://gitlist.dev/e/op.tf0n3bjjqpav6l%40crystal.sienna.ath.cx
In-Reply-To: <eej3g3$d9j$1@sea.gmane.org>

```
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? 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, 2006-09-17 09:51

Subject: Re: gitweb on OpenBSD (-T not supported on filesystems...)
Message-ID: <eej5qa$i3o$1@sea.gmane.org>
URL: https://gitlist.dev/e/eej5qa%24i3o%241%40sea.gmane.org
In-Reply-To: <op.tf0n3bjjqpav6l@crystal.sienna.ath.cx>

```
Andrew Pamment wrote:

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

> 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, 2006-09-17 15:07

Subject: Re: gitweb on OpenBSD (-T not supported on filesystems...)
Message-ID: <864pv6sfag.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/864pv6sfag.fsf%40blue.stonehenge.com
In-Reply-To: <eej5qa$i3o$1@sea.gmane.org>

```
>>>>> "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.

>> 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!

```
