[ACL-Devel] archiving acls: tar and cpio

Michael Ju. Tokarev mjt at tls.msk.ru
Sat Oct 14 00:38:05 GMT 2000


Oh, forgot to mention.

About solaris implementation.

For tar, option to store/restore acls
is the same as used to (re)store file
owner/permissions in gnu tar -- it is
`-p'.  Don't know if this option defined
in POSIX.  From tar manpage:

 p  Restore the named files to their  original  modes,  and
    ACLs  if  applicable,  ignoring  the  present umask(1).
    This is the default behavior if invoked  as  super-user
    with  the  x function letter specified.  If super-user,
    SETUID and sticky information are also  extracted,  and
    files  are restored with their original owners and per-
    missions, rather than owned by root.  When  this  func-
    tion  modifier  is  used  with the c function, ACLs are
    created in the tarfile along  with  other  information.
    Errors will occur when a tarfile with ACLs is extracted
    by previous versions of tar.


For cpio, corresponding option is `-P', that has no
meaning in gnu cpio:

 -P  Preserve ACLs.  If the  option  is  used  for
     output,  ACLs  if  existed  are written along
     with other attributes to the standard output.
     ACLs are created as special files with a spe-
     cial file type.  If the option  is  used  for
     input,  ACLs  if  existed are extracted along
     with other attributes  from  standard  input.
     The  option recognizes the special file type.
     Note that errors will occur if a cpio archive
     with  ACLs  is extracted by previous versions
     of cpio.  This option should not be used with
     the  -c  option,  as  ACL  support may not be
     present on all  systems,  and  hence  is  not
     portable.  Use ASCII headers for portability.

GNU version of both utilities warns about unknown
file type and skip contents (acl data).

What is bad is that both solaris utilities (from 5.6
release that I have) will fail gracefully on restore
if there are problems restoring ACLs, esp. when
utility fails to resolve name to id.
Also, there is an inconsistency between standard
cpio header and acl data: cpio only stores uid/gid
(numerically), but acl data uses names only.
For tar there is no such inconsistency, since
at least gnu tar by default uses names first
(but stores both [ug]id and names, and will try
to use [ug]id if get{pw,gr}nam() faied).
To Unsubscribe: send mail to majordomo at cyrus.watson.org
with "unsubscribe posix1e" in the body of the message



More information about the posix1e mailing list