bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] new feature suggestion


From: Markus Kuhn
Subject: Re: [Bug-tar] new feature suggestion
Date: Wed, 12 May 2004 11:07:05 +0100

Sergey Poznyakoff wrote on 2004-05-12 08:00 UTC:
> Hi Markus,
> 
> Markus Kuhn <address@hidden> wrote:
> 
> >  Would it be possible to add to GNU tar a new option
> >   --max-cwd-additions=1
> > that aborts the extraction of an archive with an error message if this
> > extraction would create more than 1 file or subdirectory in the current
> > working directory
> 
> That is an interesting idea. I'll think about it. By the way, what should
> tar do before aborting? Should it delete the files it has already extracted?

How about this:

It could interactively ask whether the user wants to

  a) abort immediately
  b) branch off a new subdirectory and move everything extracted into there
     (next question will ask for subdirectory name)
  c) continue
  d) delete the files extracted so far and then abort

When I receive a file "package-1.23.tar.bz2", then I want to make sure
that its contents get unpacked inside a subdirectory with name like
"package-1.23/", independent of whether it was already packed that way
or not.

The answers to the above interactive questions could even be appended to
--max-cwd-additions=1, e.g.

  tar xvf --max-cwd-additions=1b:package-1.23 /usr/archive/package-1.23.tar

would -- if the extraction generates more than 1 file in the current working
directory -- create a new subdirectory package-1.23/ and then move everything
extracted into there.

The form

  tar xvf --max-cwd-additions=1b: /usr/archive/package-1.23.tar

would derive the subdirectory name from the name of the tar file, by
removing the suffix and any path. This would also be the default offered
for the new subdirectory name in the interactive query.

Markus

-- 
Markus Kuhn, Computer Lab, Univ of Cambridge, GB
http://www.cl.cam.ac.uk/~mgk25/ | __oo_O..O_oo__





reply via email to

[Prev in Thread] Current Thread [Next in Thread]