Re: Need FreeBSD wizard for zgv port (long)

Search this archive.

From: Lars Eighner (eighner@io.com)
Date: Sat 14 Oct 2000 - 01:48:08 IST


In our last episode,  <200010131335.IAA03937@interlink-bbs.com>,
the lovely and talented Russell Marks

RM> It's possibly a little odd to post a reply on linux-svgalib, but I
RM> didn't want people to think I'd just ignored this. :-)

There isn't a freebsd-svgalib mailing list and the FreeBSD port is less
than a month old (not even mouses yet). (Besides svgalib is heresy
on the freebsd lists.)

>> I get [zgv] to work from a ttyv that root is signed into, and it is
>> swift, beautiful, wonderful, etc.  But it

RM> Nooooo! What did you do to it!? :-)

It is wonderful, especially the way it handles animated gifs.
This is the first console thing for a uniod that I have found
that I can pronounce better than anything I have seen on DOS.

>> is kind of beside the point as the whole idea is to run it as a
>> regular user.
>> 
>> So basically, I got the trivia out of the way but since I have no
>> idea what I am doing, I can't solve the
RM>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I can relate to that. :-)

>> central problem.
>> 
>> Here is where the problem is in the original code:
>> 
RM> [zgv.c's fixvt() snipped]
>>  Here are the changes I have made to it so far: mostly due to using
>> consio.h instead of vt.h

RM> You don't actually say where it's giving up, though. I'll guess
RM> it's here:

>> /* now, before we go for it, we test the *current* VT to see if
>> they * own it. If so, the user's probably `genuine'.  * (NB: the
>> kernel now does this, but there's no harm repeating it.)  */
>> snprintf(vt_filename,sizeof(vt_filename),"/dev/ttyv%x",original_vt);
>> stat(vt_filename,&sbuf); if(getuid()!=sbuf.st_uid) {
>> fprintf(stderr, "zgv: you must be the owner of the current console
>> to run zgv.\n"); exit(1); }

RM> Does it work if you cut out the if()? 

Kernel panic from page fault.  (Maybe I did something wrong, but since
I got it working --see below-- I'm not spending the rest of my life
trying to reproduce this.)

RM> Have you checked what
RM> getuid() and sbuf.st_uid are? Is stat() working?

Yes.  It is very curious.  Getuid is the user, but sbuf.st_uid
is root - in other words (I think) it knows I'm me, but running
suid it thinks my virtual console belongs to root.

Well, I discovered when I tested for the right major mode (a
FreeBSD ttyv is 12) we branched out before we got to this point
and my argument was really with svgalib, not zgv.  I hacked
the ID test out of svgalib 8^} and everything works great, I ditch
root when vga inits, and everything seem fine.  Works great
with lynx.  Next objective: make it the image viewer for
console xemacs!


>> Known dependencies: svgalib, jpeglib, pnglib, tifflib --

RM> tifftopnm, you mean, and it's not actually a requirement. :-) I've
RM> noticed a rather hairy problem with the TIFF support though, so
RM> I'd recommend disabling it for now (making it return an error in
RM> vgadisp.c is probably easiest). I've fixed that in 5.2, which I
RM> should be releasing in a few days.

>> uses gawk as is, but of course it could be awk (just for man page),
>> [...]

RM> Unfortunately, "of course it could be awk" is probably not the
RM> case.  Quoting makeman.awk:

>> # Requires gawk (it uses `gensub' (gawk only?) and `[:blank:]'
>> (POSIX)).

I did it both ways and didn't notice a problem.  But then I don't
spend a lot of time reading docs :-).

Probably I won't be porting this to FreeBSD because they are afraid
the commies are going to come in through svgalib as it was and
they will be very nasty if I admit to hacking it.  Of course, they
think everyone is running a major net server that controls NORAD
and don't get it that some people run FreeBSD at home where security
is a beagle that will nip anyone else who tries to su root

RM> `gensub' is gawk-specific, and there are some uses of it in there
RM> which I think would be rather difficult to convert to
RM> sub/gsub. I've already run into this one with xzgv; my `solution'
RM> there was (or rather, will be, in 0.6) to just include a prebuilt
RM> man page in the tgz. A bit crap, but it works. :-)

>> zgv/Makefile
>> 
>> line 31: delete src/install-info from src:
>> 
>> This install-info is meant to take the place of texinfo 3.12. Since
>> texinfo is installed with the system in FreeBSD (and since I can't
>> get this install-info to work, and since it has nothing to do with
>> the basic purpose of zvg) we pretty much have no use for it.

RM> True enough, but what's the problem?

It pukes on the FreeBSD getopts.h -- although there are unfortunately
a lot of totally unrelated headers that have the name getopts.

>> zgv/src/readnbkey.c
RM> [...]
>> line 48 & line 52-62: comment out.
>> 
>> This is a bad hack to deal with a bad hack.  For certain historic
>> and mnemonic reason best known to the author, he wishes to emmulate
>> the old behavior of keyboards with only 10 F keys so that Shift-F1
>> = F11 and Shift-F2 = F12.  He is

RM> It's more to do with what the old keymaps did. [1] The idea is to
RM> give consistent behaviour whether F11/F12 are distinguishable or
RM> not - with the old keymaps you couldn't tell the difference
RM> between (e.g.)  Shift-F1 and F11, so this is the only approach
RM> which works in all cases. You've done the right thing though,
RM> assuming FreeBSD hasn't had this keymap-change problem.

RM> [1] With `old' here meaning `you *do* realise that zgv dates back
RM> to 1993, right?'. :-) 

1993 -- when dinosaurs roamed the earth.

Thanks.  Zgv is just great.  I can't think of anything I want
that isn't there.

-- 
  Lars Eighner           eighner@io.com           http://www.io.com/~eighner/
                    Save the Rainforest! Eat a vegetarian!


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST