Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mtree: add xattr support #1400

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Commits on Jul 18, 2020

  1. Configuration menu
    Copy the full SHA
    acfa7bc View commit details
    Browse the repository at this point in the history
  2. mtree: add xattr support

    This adds support for optionally writing xattrs to mtree output, and
    limited ability to read them from mtree input. The format of the keyword
    is the following, one for each xattr present for the entry:
    
    xattr.<name>=<b64 encoded value>
    
    This format is inspired by go-mtree by Vincent Batts, though
    there is a possible slight incompatibility: libarchive's existing base64
    encoder does not perform padding because it was written to encode xattrs
    into PAX attributes which already have a length component. The decoder
    should accept padding ok, but the mtree parser may not like the
    unescaped '=' characters.
    
    The name is escaped according to existing mtree escaping practices which
    is octal encoding of [^!-}] except [ #=\] is also encoded.  go-mtree
    performs its own implementation of vis(3) on it with the flags
    VIS_WHITE, VIS_OCTAL, and VIS_GLOB. There is some disjointedness here
    but it should be compatible in the common case of no escaping of course.
    
    Note that for output this is gated on --options=mtree:xattrs, which I've
    left out of the default mtree options.
    
    So far I've tested converting a PAX file directly to mtree with bsdtar
    and it seems to work well.
    
    todo:
    
    * when reading an mtree, also fill in xattrs from disk if available -
      this is tricky...
    * PAX tar files made by libarchive default to putting both the
      LIBARCHIVE and SCHILY PAX attributes in order to encode xattrs, but
      this causes libarchive to store the same xattr twice internally.
      Therefore if converting directly from PAX to mtree you get duplicated
      xattrs in the output. I don't think there's any easy way to fix this
      other than changing how libarchive keeps track of xattrs internally.
    maxcrees committed Jul 18, 2020
    Configuration menu
    Copy the full SHA
    058f10a View commit details
    Browse the repository at this point in the history
  3. Fix building with cmake

    maxcrees committed Jul 18, 2020
    Configuration menu
    Copy the full SHA
    287ac69 View commit details
    Browse the repository at this point in the history