Subject: Re: Text form of wtmp
To: Greywolf <greywolf@starwolf.com>
From: Valentin Nechayev <netch@lucky.net>
List: tech-userlevel
Date: 02/16/2005 14:12:49
 Tue, Feb 15, 2005 at 16:40:44, greywolf wrote about "Re: Text form of wtmp": 

VS>> Why can't we use text file for wtmp? wtmp is just a log file, that is
VS>> similar to other log files in system. We need to fix only last and ac
VS>> programmes and libutil routines to work with text wtmp. I understand,
VS>> that analyzing of wtmp records would be more complex, but wtmp would be
VS>> in human readable form. And we would not need to trim hostname, because
VS>> even in wtmpx the maximum hostname length is 256 bytes, and real max
VS>> length is 1024 bytes.
> wtmp is a binary file with fixed length records because it makes for much
> faster processing.

Does faster processing really gives anything important in that particular
case? There are too few tasks which require automatic reading of wtmp.
First law of optimization says "Don't optimize unless really needed".

>  It's easier, computing-wise to parse a file of records
> of fixed size and display them in text format than it would be to parse
> a file of records of varying size and deal with them.

It's easier for too many tasks to use binary formats, protocols and
fixed-size records, but it's not Unix world style and not Internet world
style.

> We would not gain anything by converting wtmp from fixed-size-record
> format to text format.  Humans are not the only things who gain from
> reading the information inside wtmp.

Well, what about changing of /etc/group to binary format?;)) It will be much
easier to parse, and this is really needed (initgroups() can be called
hundreds per second), unlike quite rare reading of wtmp...

I can imagine arguments to keep status quo - binary wtmp - due to POLA
principle. But please don't argue to binary logs in Unix world, it has no
sense :)


-netch-