From owner-freebsd-ports@FreeBSD.ORG Thu Jul 22 09:16:35 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C8DE616A4CE; Thu, 22 Jul 2004 09:16:35 +0000 (GMT) Received: from mail009.syd.optusnet.com.au (mail009.syd.optusnet.com.au [211.29.132.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E2AB43D46; Thu, 22 Jul 2004 09:16:34 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) i6M9GNf23561; Thu, 22 Jul 2004 19:16:23 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])i6M9GMVd009415; Thu, 22 Jul 2004 19:16:22 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)i6M9GMDR009414; Thu, 22 Jul 2004 19:16:22 +1000 (EST) (envelope-from pjeremy) Date: Thu, 22 Jul 2004 19:16:22 +1000 From: Peter Jeremy To: Andrey Chernov , current@FreeBSD.ORG, ports@FreeBSD.ORG Message-ID: <20040722091622.GG3001@cirb503493.alcatel.com.au> References: <40F963D8.6010201@freebsd.org> <20040719060730.GA87697@nagual.pp.ru> <40FC9FC2.8050400@kientzle.com> <20040722071929.GA13591@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040722071929.GA13591@nagual.pp.ru> User-Agent: Mutt/1.4.2i Subject: Re: NEW TAR X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2004 09:16:36 -0000 On Thu, 2004-Jul-22 11:19:29 +0400, Andrey Chernov wrote: >On Mon, Jul 19, 2004 at 09:29:54PM -0700, Tim Kientzle wrote: >> but they're not gtar-compatible. (The gtar >> approach has a number of drawbacks. The primary >> one being that on many systems it requires reading >> the entire file twice, once to find holes and again >> to actually archive the file. It is possible to >> do both in one pass if you store the sparse file >> data in a different fashion.) > >I can't imagine the case when 2 passes are needed. Even if you have normal >file in the archive and specify -S only when extracting (it should work as >expected), only 1 pass is needed. Just stop on first '\0' and count them >until they finished, then do lseek (real case will be a bit harder to >implement because of block boundaries). I thought gnutar implemented sparse files by writing a bitmap of used blocks vs holes followed by the actual data. This needs 1 pass to calculate the bitmap and a second pass to write the data. You probably don't want to unnecessarily convert holes to data in your archive. Some Un*x systems generate a core dump by writing the process memory map to a file - holes and all - giving you a sparse file that appears to be several GB in size. Older dbm variants also tended to leave large holes in the .pag file from memory. -- Peter Jeremy