"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: got-archive(1) (now with a patch)
To:
gameoftrees@openbsd.org
Date:
Fri, 29 Dec 2023 17:19:57 +0100

Download raw body.

Thread
Stefan Sperling:

> Writing the tar headers directly is clever and avoids having to
> run an external 'tar' program. I hope though that this won't run
> into subtle bugs that result in incompatibilities with some
> implementations of tar. The header looks simple enough but I do
> not have enough experience with the tar file format to judge this.

The ustar headers suffer from size restrictions, most notably the
maximum filename length.  This is not a theoretical concern.  It
is already impossible to generate a ustar archive of the OpenBSD
ports tree, which is why jca@ has been adding support for extended
pax headers to OpenBSD's pax(1).  Ustar headers also cannot encode
file sizes >= 8 GB.

I just checked "git archive", and it generates extended pax headers
where required.

The ustar header formatting in Benjamin's patch needs further work:
* Numeric fields need to be zero-padded.
* Currently, the filename length is limited to 99 bytes.  The ustar
  format already has an extension for a 155-byte prefix + a 100-byte
  name.
* There are no checks whether something fits into a header field,
  larger values are silently truncated.  Careful, according to the
  spec some fields are NUL-terminated, others are not.

POSIX specs:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de