Help! calling tar from Python on Linux

Martin Pool martinp at mincom.com
Wed Oct 20 01:52:25 EDT 1999


Carel Fellinger wrote:
> 
> Preston Landers <prestonlanders at my-deja.com> wrote:
> > In article <5loge456a9.fsf at eric.cnri.reston.va.us>,
> >   Guido van Rossum <guido at cnri.reston.va.us> wrote:
> 
> >> My guess as to why he's getting the error that he's getting is that
> >> tar somehow stops reading the gzip output before gzip is done.  Maybe
> >> the rest of the tar output (if there's any) would be a clue.
> 
> > There was no additional output from tar.  I used the verbose flag, and
> > it printed that it untarred' all the files, then it printed the message
> > about recieving exit code of 1 from gzip.
> 
> Guido's remark shed a faint light on some almost extinct part of my brain
> and suddenly I start remembering that once I encountered a similar behaviour
> of tar and gzip. It had to do with excess bytes in the gzipped file, but
> elas my memory is like it always was, a rusty colander, and no matter what
> I try I can't reproduce it on my current machine. I also dimmly remember
> something like it had to do with tar-balls from elsewhere, not locally made
> ones. Well, this isn't going to help you much, is it. And I lack the old
> Atari the try it out:(

If there is more data after the end of a gzipped file, gzip will assume
it's another gzip file and try to read it's header.  If the trailing
data isn't a proper header, gzip will return an error.  

This gives you the nice feature of being able to just concatenate gzip
files and read them back as if they were concatenated plaintext files. 
However, if trailing garbage somehow gets onto the file (who knows how?)
then you might experience these symptoms.

-- 
 /\\\  Mincom | Martin Pool          | martinp at mincom.com
// \\\        | Software Engineer    | Phone: +61 7 3303-3333
\\ ///        | Mincom Ltd.          | 
 \///         | Teneriffe, Brisbane  | Speaking for myself only




More information about the Python-list mailing list