From owner-freebsd-current@FreeBSD.ORG Tue Jun 21 02:25:06 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 714A016A41C; Tue, 21 Jun 2005 02:25:06 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4001D43D55; Tue, 21 Jun 2005 02:25:06 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from freebsd.org (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id j5L2P5OZ034808; Mon, 20 Jun 2005 19:25:05 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <42B77A6B.6090906@freebsd.org> Date: Mon, 20 Jun 2005 19:24:43 -0700 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: Tim Robbins References: <20050617214658.GA41804@troutmask.apl.washington.edu> <58826.1119044951@critter.freebsd.dk> <20050617220222.GA42080@troutmask.apl.washington.edu> <20050617220653.GA114@saltmine.radix.net> <20050617221353.GA48584@troutmask.apl.washington.edu> <20050618061603.GM50157@cirb503493.alcatel.com.au> <20050619033904.GB3061@dragon.NUXI.org> <20050619070640.GQ50157@cirb503493.alcatel.com.au> <42B5C0BC.40904@freebsd.org> <20050620092543.GA54301@cat.robbins.dropbear.id.au> In-Reply-To: <20050620092543.GA54301@cat.robbins.dropbear.id.au> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: cpio/pax using libarchive? (was Re: Replace /rescue/vi with mined(1) from DragonFlyBSD) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2005 02:25:06 -0000 Tim Robbins wrote: > > This is a bit off topic, but is there a good reason (other than lack of > time) that cpio and pax could not be rewritten to use libarchive? None at all. I've focused on tar primarily because I use it more than the others myself, and because I keep dreaming I'll find time to get back to work on libpkg. If anyone would like to tackle this, I have one concrete suggestion: start with passthrough (copy) mode. If I understand it correctly, it can be implemented quite simply by forking: /* process args, set up read_arg_struct and write_arg_struct */ switch (mode) { case PASSTHROUGH: { int fd[2]; pipe(fd); if (fork()) cpio_read(fd[0], read_arg_struct); else cpio_write(fd[1], write_arg_struct); break; } case READ: { cpio_read(...); break; } case WRITE: { cpio_write(...); break; } } A lot of the detailed code can doubtless be cribbed from tar. Once you've figured out 'cpio', then basic 'pax' should be pretty simple. Hardest part of 'pax' is working on the regex substitutions and extended pax attribute overrides (which will require augmenting the libarchive API in tricky ways). Tim