Date: Fri, 16 Jan 2004 15:16:51 -0800 From: Tim Kientzle <kientzle@acm.org> To: Don Lewis <truckman@FreeBSD.org> Cc: freebsd-arch@FreeBSD.org Subject: Re: Request for Comments: libarchive, bsdtar Message-ID: <400870E3.8040508@acm.org> In-Reply-To: <200401150537.i0F5bo7E041482@gw.catspoiler.org> References: <200401150537.i0F5bo7E041482@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?400870E3.8040508>