From owner-freebsd-arch@FreeBSD.ORG Fri Jan 16 15:16:54 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 A984816A4CE; Fri, 16 Jan 2004 15:16:54 -0800 (PST) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 24CFB43D3F; Fri, 16 Jan 2004 15:16:53 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org ([66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id i0GNGqkX085545; Fri, 16 Jan 2004 15:16:52 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <400870E3.8040508@acm.org> Date: Fri, 16 Jan 2004 15:16:51 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031006 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Don Lewis References: <200401150537.i0F5bo7E041482@gw.catspoiler.org> In-Reply-To: <200401150537.i0F5bo7E041482@gw.catspoiler.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 Reply-To: kientzle@acm.org 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:16:54 -0000 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