From owner-freebsd-arch@FreeBSD.ORG Fri Jan 16 15:33:31 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95A3B16A4CE; Fri, 16 Jan 2004 15:33:31 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 406DB43D62; Fri, 16 Jan 2004 15:33:20 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i0GNXA7E047016; Fri, 16 Jan 2004 15:33:14 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200401162333.i0GNXA7E047016@gw.catspoiler.org> Date: Fri, 16 Jan 2004 15:33:10 -0800 (PST) From: Don Lewis To: kientzle@acm.org In-Reply-To: <400870E3.8040508@acm.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: tjr@FreeBSD.org cc: freebsd-arch@FreeBSD.org Subject: Re: Request for Comments: libarchive, bsdtar X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2004 23:33:31 -0000 On 16 Jan, Tim Kientzle wrote: > 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? Sounds good to me.