[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [rfc] leverage -x/-X tar call to pass more tar options



On Thu, Jul 08, 2010 at 02:03:21PM +0200, Guillem Jover wrote:
> Hi!
> 
> On Sun, 2010-07-04 at 00:20:02 +0200, Pierre Habouzit wrote:
> > I'm in the process of moving apt-listchanges to C, slowly, and the
> > attached patch would make it really easier for me to work with dpkg-deb.
> 
> Just OOC, why C and not C++ being it supposedly part of the apt
> namespace?
> 
> Ok, I've checked now the source and I guess the answer might be,
> because it does not really depend on anything apt related (except
> for the invokation hook protocol to retrieve the package and version
> list). If we extended the dpkg invoke hooks, apt-listchanges could
> become something lower level, that could be hooked directly into dpkg.
> 
> > The point is that doing chained pipes is pretty annoying from C
> > (especially if you want to use parallelism in the process), plus it kind
> > of make sense for many kind of operations where you don't need
> > --fsys-tarfile anymore: e.g. extracting a single file can be done with:
> 
> Well, as surely it might be slightly annoying, I don't think it implies
> that much code. It's oubviously easier and more comfortable to be able
> to extract specific files to extract, it's also more performant than
> filtering them out after the fact. So I agree it's a nice feature to
> have, but ...
> 
> >     dpkg-deb -x file.deb some-dir ./path/to/file/to/extract
> > 
> > What I do is that additionnal arguments passed after the "directory"
> > argument of -x and -X are passed straight to tar.
> 
> .... definitely not by allowing any option to be forwarded to tar,
> which would make the fact that we are internally using the tar binary
> an exported interface. And in case we wanted to switch to a pure C
> implementation we'd have to either break or support parsing random tar
> options!
> 
> What I can see as acceptable would be to only allow additional
> optional filenames after the directory argument. But then I guess that
> might not be enough, and we might need to support wildcards too. So
> the tar call would end up being something like:
> 
>   if $tar_files
>     tar xpf - --wildcards -- $tar_files
>   else
>     tar xpf -

That was my first version of the patch indeed, though I found it too
restrictive at first.

I'll try to reroll it to that then
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org


Reply to: