[ACL-Devel] tar file format?

Michael Tokarev mjt@tls.msk.ru
Thu, 13 Apr 2000 14:26:31 +0400


Linda Walsh wrote:
> 
> Andreas Gruenbacher wrote:
> >
> > Michael Tokarev wrote:
> > >
> > > Does anybody knows how the acl entries should be represented
> > > in tar?
> >
[]
>         Under Irix there is a -M option that is supposed to store all the
> CAP, MAC and ACL information.  It dumps it to 1 specific file, say "/tmp/.foo".
> So if you looked at the tar, you'd find a copy of /tmp/.foo for each file on the
> tape.  When it is unpacked, tar should read the /tmp/.foo after it restores each
> file and set the ATTR block up accordingly.  If you unpacked with a normal
> version of tar that doesn't know about ATTR's, it would just write over /tmp/.foo
> a bunch of times needlessly.  I suppose at the end of an archive an empty /tmp/.foo
> should be written to zero out the last remaining ATTR block info.

Hm. This seemed to be very bad idea. Acls, CAP, MAC etc should be _in_ tar archive,
so this info can be safely backed up and restored (possible in different machine)
without any addition files.  What is tar? -- it is just a collection of files (and
attributes) that resides in one (!) another archive file, and this another file is
good to backups, transfers etc etc.  _One_ file.  One possible solution is to merge
that /tmp/.foo into resulting tar archive, but this is not perfect (as tar format
stores all related file info with file, so that it will not need to seek inside
archive to restore all file info (esp. on tapes), and even if so, /tmp/.foo will
become an implementation detail).

As I found at solaris, there is just a special "file" type defined.
Among with (cut&paste from tar.h):
#define REGTYPE         '0'
#define AREGTYPE        '\0'
#define LNKTYPE         '1'
#define SYMTYPE         '2'
#define CHRTYPE         '3'
#define BLKTYPE         '4'
#define DIRTYPE         '5'
#define FIFOTYPE        '6'
#define CONTTYPE        '7'
there is additional "ACLTYPE" (but that is not defined in header), e.g.
#define ACLTYPE         'A'
Archived file with acls looks like:

  0 (regtype) block with name, owner, group, {amc}time, unix perms etc (512 bytes)
  some blocks with file data
  A (acltype) block with name (again!) and some info I don't know of (512 bytes)
  some blocks with acl info (in some strange format, with garbage at the end)

With this, tar that doesn't knows about ACL (as gnu tar) just prints "unknown
file type `A'" and skips remainding blocks.

> -l
> 
> --
> Linda A Walsh                    | Trust Technology, Core Linux, SGI
> law@sgi.com                      | Voice: (650) 933-5338
-------------------------------------------------------------------------
Linux ACL Developers List ---  http://acl.bestbits.at/acl-devel/

To unsubscribe, send a message with `unsubscribe acl-devel'
in the message body to majordomo@bestbits.at.
-------------------------------------------------------------------------