[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile 100 Prob #4 TAR files

From: Mike Gran
Subject: Re: Guile 100 Prob #4 TAR files
Date: Sat, 4 May 2013 19:47:44 -0700 (PDT)

> From: Mark H Weaver <address@hidden>

> I've attached my solution to Guile 100 Problem #4: TAR files.  It should
> work with Guile 2.0.5 or later.
> This program does more than you asked for.  It aims to be a fully
> functional producer of USTAR archives, and follows the behavior of GNU
> tar with the --format=ustar option.  In particular, directories,
> symlinks, fifos, and device files are handled as in GNU tar.  The only
> missing feature I'm aware of is hard link detection.


> Some notable differences from your specification:
> * A footer (1024 null bytes) is placed at the end of the entire archive,
>   not at the end of each file.  USTAR readers stop reading the file when
>   they find a footer.

You're right that the footer isn't at the end of each file.

> * The checksum field actually has format number[7] followed by a space,
>   i.e. six octal digits followed by a NULL and a space.

This one's a bit controversial.  OpenBSD tar uses 7 octal + NULL.
The Posix description of ustar in pax doesn't mention the space, either.

I made a few test cases and tried to break your script, but, I could
find no easy flaw.  Awesome.  I was only testing regular files, though.

Not that speed was the point of this exercise, but, in
creating an archive from 10000 6kB text files, this script was
about 8x slower than GNU tar, and slightly faster than Jez's solution.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]