Re: Request for Comments: libarchive, bsdtar

From: Tim Kientzle (kientzle_at_acm.org)
Date: 01/17/04

  • Next message: Don Lewis: "Re: Request for Comments: libarchive, bsdtar"
    Date: Fri, 16 Jan 2004 15:16:51 -0800
    To: Don Lewis <truckman@FreeBSD.org>
    
    

    On 15 Jan, Tim Robbins wrote:
    >- Padding gzip'd tar archives (with bsdtar czf) causes [various problems]

    I've updated libarchive so that:
       * last-block padding is set with a separate API call that can
         be invoked at anytime before the archive is closed
         (In particular, it can be invoked from within the client open
         callback.)
       * If it is not set manually, then the default behavior is:
            = uncompressed data within a gzip/bzip2 compressed stream
              is always padded
            = if archive_write_open_file is used, then the last block
              is padded if the output is stdout or a character or block
              device, otherwise the last block is not padded
            = if archive_write_open_file is not used, then the
              "default default" behavior is for the last block
              to not be padded. This may change.

    This appears to match the behavior of gtar.
    I've updated bsdtar to simply use the library defaults.

    Don Lewis wrote:
    > I would prefer to have explicit control of this behavior.
    > BTW, ... an enhanced version of dd ... had the useful option "mobs", which was
    > used to specify a minimum output block size.

    libarchive now has an API function: archive_write_set_bytes_in_last_block

    Unfortunately, the name is a bit misleading; suggestions appreciated.

    As a special case, if the argument to this function is zero, the
    last block will be padded to the full block size. Otherwise, the
    last block will be padded to a multiple of the indicated value.
    For example, if you specify 1024, and the block was 1025 bytes, it will
    get padded to 2048. If you specify 1, no padding will be added.
    However, in no case will the last block be padded to be larger than the
    archive block size (as set with archive_write_set_bytes_per_block).

    As described above, the archive_write_open_file function will
    set this for you only if you have not already invoked it manually.
    If you use the low-level archive_write_open, then you're on your own.

    Does this provide the "explicit control" you were looking for?

    Tim Kientzle

    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Don Lewis: "Re: Request for Comments: libarchive, bsdtar"