Date: Mon, 20 Jun 2005 19:24:43 -0700 From: Tim Kientzle <kientzle@freebsd.org> To: Tim Robbins <tjr@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: cpio/pax using libarchive? (was Re: Replace /rescue/vi with mined(1) from DragonFlyBSD) Message-ID: <42B77A6B.6090906@freebsd.org> In-Reply-To: <20050620092543.GA54301@cat.robbins.dropbear.id.au> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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. <sigh> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42B77A6B.6090906>