Article View: news.software.nntp
Article #56807Re: [yEnc] Survey time! (Compression or not?)
From: Curt Welch
Date: Fri, 22 Feb 2002 17:09
Date: Fri, 22 Feb 2002 17:09
110 lines
6542 bytes
6542 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Curt Welch <curt@kcwc.com> writes:
> > Russ Allbery <rra@stanford.edu> wrote:
>
> >> You can do that if you want, if you intentionally use the low-level
> >> zlib routines, but the standard zlib calls write gzip files. It's
> >> basically the same as the output of gzip. I use this all the time as
> >> part of my job; I know it's true.
>
> > Ok, which low level routines? compress()/uncompress() or deflate()/
> > inflate() etc?
>
> Right.
>
> > It's obvious the gz* routines will be creating gzip file format. What
> > does compress() create and what does deflate() create? I assumed both
> > would be the same and both would be zlib format?
>
> I would assume that they're generating the compressed streams without the
> headers, yes. (I find your term "zlib format" to be extremely confusing,
> since zlib creates gzip files when you tell it to create a file.)
The terminology is not mine. It comes from the RFCS:
RFC 1950 - ZLIB Compressed Data Format Specification version 3.3
RFC 1952 - GZIP file format specification version 4.3
zlib is a set set of compression routines. The compress() and uncompress()
routines produce RFC 1950 format data. That data is not gzip compatiable.
It also includes a set of stdio-like wrappers that can produce .gz files
in the RFC 1952 gzip format. But those only seem to work when writting
to disk, not when trying to do in-core compression which is what zlib does.
> > No, it looks like I was right. The compress() and uncompress() zlib
> > functions are not returning data in gzip format. It looks like zlib
> > format.
>
> Why are you using those functions rather than using the gzopen() /
> gzwrite() interface?
Do you remember the context of this discussion? It was about including
compression in the yEnc encoding. When you do that, you tend to write
code which reads a file a buffer at a time, and writes out the encoded
version to the article you are creating. When you add compression, you read
a file a buffer at a time, compress the buffer (in memory), then you encode
it, then you write it to the article.
How do you do that with zlib without using compress() and uncompress()?
How do make zlib do that in-core and also create a gzip compatibale data
stream? At first glance, it seems there is no way to do it. You are forced
to read the uncompresed, file, write out a gzip file to disk, then read
that file, and encoded it to create your article. Half the point of
including something like the zlib routines in a newsreader is to cut out
the extra step of having to write the compressed file to disk.
> I don't understand what you're trying to argue.
I'm not really arguing anything anymore. My points started because I
thought zlib was NOT gzip. It really is. Once I realized that, then, most
the points I was making about using zlib as a part of yEnc don't apply - or
the strengh of that side of the argument is reduced greatly.
Now I'm just trying to help you to understand the semantics of my last
post. :)
> First you said that zlib
> wasn't the same compression format as gzip, then you said that zlib
> couldn't write files that gzip can read,
You are just getting lost in the terminology issues I was picking up from
the RFCs. I was using the term "zlib format" as it was defined in
the RFC, not the more obvious way that you are thinking about it as
"the format the gz* zlib wrapper routines produce".
> and now you're saying that if
> you intentionally use functions that aren't interoperable with gzip,
> they're not interoperable with gzip. Well, the first two statements
> aren't true, but the last statement is, certainly. But I really no
> longer understand your point.
It's all done with mirrors. :)
> My point is that if you want to generate something that gzip can
> decompress, zlib works just great. You seem to be continuing to disagree
> with me, and I'm extremely confused about the grounds for your
> disagreement.
>
> Like I said, I have programs that *do* this. It works fine.
This is what I'm having a problem with...
Can you use the zlib routines to produce an in-core gzip compatiable
data stream without writing it do disk? How? It looks to me like you
can't. That is not what I think of as "It works fine".
The gzip format is simple enough that even if my understanding is correct
about what you can and can't do with the zlib routines, it would still be
easy to do what I wanted by hand-crafting the gzip headers and calculating
the CRC by hand. But that's a lot more complex than just a sequence of
calls to compress() which is what I would expect from a "gzip compression
library" which is why I was trying to point on that even though zlib is the
compression algorithm for gzip, zlib format and gzip format are not exactly
the same thing.
--
Curt Welch http://CurtWelch.Com/
curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20020222120943.799$AG@newsreader.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!portc03.blue.aol.com!feed1.newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<a504os$736$6@pegasus.csx.cam.ac.uk> <200220022141483852%planb@newsreaders.com> <20020220230116.405$a3@newsreader.com> <1014270020.729921@ok-corral.gunslinger.net> <20020221152617.647$FV@newsreader.com> <a53ut8$7i4$4@pegasus.csx.cam.ac.uk> <20020221183904.819$lz@newsreader.com> <yleljecpr8.fsf@windlord.stanford.edu> <20020221224023.453$bg@newsreader.com> <ylr8ne6pve.fsf@windlord.stanford.edu> <20020222021334.828$pl@newsreader.com> <ylvgcq3q5r.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <20020222120943.799$AG@newsreader.com>
Subject: Re: [yEnc] Survey time! (Compression or not?)
Date: Fri, 22 Feb 2002 17:09:43 +0000
From: curt@kcwc.com (Curt Welch)
References: <a504os$736$6@pegasus.csx.cam.ac.uk> <200220022141483852%planb@newsreaders.com> <20020220230116.405$a3@newsreader.com> <1014270020.729921@ok-corral.gunslinger.net> <20020221152617.647$FV@newsreader.com> <a53ut8$7i4$4@pegasus.csx.cam.ac.uk> <20020221183904.819$lz@newsreader.com> <yleljecpr8.fsf@windlord.stanford.edu> <20020221224023.453$bg@newsreader.com> <ylr8ne6pve.fsf@windlord.stanford.edu> <20020222021334.828$pl@newsreader.com> <ylvgcq3q5r.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!portc03.blue.aol.com!feed1.newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com wjcLN/RS4ZxILsaFHJ1yBlEpoFc@udjDPNVV@5g_maSa=Y9e2
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
%IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 109