After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 73409 - logview should understand compressed log files
logview should understand compressed log files
Status: RESOLVED FIXED
Product: gnome-utils
Classification: Deprecated
Component: logview
trunk
Other All
: Normal enhancement
: GNOME2.x
Assigned To: gnome-utils Maintainers
gnome-utils Maintainers
Depends on: 157275
Blocks:
 
 
Reported: 2002-03-04 18:25 UTC by Jochen Voss
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Jochen Voss 2002-03-04 18:25:17 UTC
Hallo,

as many logfile rotation schemes use gzip
to compress old log files, it would be nice
if logview would be able to read compressed
logfiles.

Jochen
Comment 1 Glynn Foster 2002-05-01 13:44:44 UTC
lets put this down for 2.0
Comment 2 Glynn Foster 2002-07-10 21:57:33 UTC
definitely 2.x
Comment 3 Vincent Noel 2004-11-03 15:54:43 UTC
logview CVS can now open gzipped and zipped logfiles.
I'm not sure if the bz2 compression should be added...

I'm closing this bug, if someone needs bz2 he should open another bug.
Comment 4 James Bowes 2004-11-03 17:25:00 UTC
I'm re-opening this. Vincent: you should probably implement this using the
gnome-vfs methods, rather than calling an exteral program and creating a tmp file.

eg: file:/path/to/log#gzip:
Comment 5 Vincent Noel 2004-11-03 18:01:11 UTC
Thanks, I was not aware of that, I am just learning gnome-vfs :P
However it seems like getting the file info with gnome-vfs on a zipped file
returns weird results (ie it returns the size of the zipped file and not the
expanded file). Any hint ? :)
Comment 6 James Bowes 2004-11-03 18:26:01 UTC
the gnome-vfs method for gzip (and i'd assume for zip), reads and writes to the
file sequentially, so that you don't have to expand the entire thing into memory
or onto disk at once, unless you choose too. as a consequence, you can really
tell any information about the uncompressed file unless you actually uncompress
it entirely yourself...

so the method returns information about the gzip file, and then pulls out what
it can about the uncompressed file inside

but since the logs sit on disk as compressed files, that's probably a better
file size to give to the user. anyways, since the two numbers will match
Comment 7 Vincent Noel 2004-11-03 18:54:23 UTC
What I mean is that in order to read the (uncompressed) file I must know its
size in order to g_malloc enough memory.
I've tried a number of things, and even gnome_vfs_seek at the end of the zipped
file makes the program crash.
If I hard-code the file size into the program the reading routines work
properly, but how do I access the uncompressed file size ???
Comment 8 Vincent Noel 2004-11-03 19:48:23 UTC
I've just checked in the source of the gzip module in gnome-vfs and the seek,
tell functions are now implemented for gzip. That explains why everything
crashes when I try to use these functions. There's also a comment that
gnome_vfs_get_file_info cannot retrieve the size of the uncompressed file.
This is very unconvenient, but I'm looking into it.
Comment 9 James Bowes 2004-11-03 20:10:14 UTC
I wouldn't worry about it. For one thing, a lot of the gnome-vfs modules can't
get the file size, because the the method that they implement don't allow it.
since you're just using the file size to allocate a buffer for chars, and then
filling it up in one big gnome_vfs_read, why not use gnome_vfs_read_entire_file
from gnome-vfs-utils?
Comment 10 Vincent Noel 2004-11-03 20:16:19 UTC
Because gnome_vfs_read_entire_file does not work for gzip files because the gzip
reading function is broken. See bug 157275 where I proposed a patch to fix this :-)
I don't know what is best : include a patched version of
gnome_vfs_read_entire_file in logview (I have this on my HD right now, and it
works) or wait for the patched gnome-vfs to come out (this requirement could be
quite hard for the people who just want to try gnome-utils).

I think I'm gonna go with the first solution, and then use the gnome_vfs
function when a new release of gnome-vfs is out. Any thoughts ?
Comment 11 James Bowes 2004-11-03 20:41:56 UTC
wait for the patched gnome-utils, ie as soon as it hits cvs. I wouldn't worry
too much about people who want to try it, since we're in a dev cycle.
Comment 12 Vincent Noel 2004-11-04 17:09:08 UTC
logview CVS now opens zipped logfiles with the gzip method. You need gnome-vfs
cvs (HEAD or gnome-2-8) to test it (otherwise, it'll crash).
Thanks for all the help ! Can I close this bug, or does anyone has
suggestions/criticism ?
Comment 13 James Bowes 2004-11-04 18:39:54 UTC
just make sure the build scripts etc are updated to reflect the new requirement...
which could probably be 2.8.2, or whatever the next stable gnome-vfs will be.
Comment 14 Vincent Noel 2004-11-04 19:22:29 UTC
Good point. Thanks for pointing this out. gnome-vfs 2.8.3 is already out since
october 28th, so I required gnome-vfs 2.8.4 in the configure.in.
Closing the bug.