Source-Changes archive

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

Re: CVS commit: src/bin/pax



On Mon, 18 Oct 2004, David Laight wrote:
> > > Will "tar -xf file.tar -C /destdir --chroot" chroot to /destdir ?
> > > Or do we have to do "(cd /destdir ; tar -xf - --chroot) <file.tar"
> > > to get that effect?

> > So "tar -xf file.tar --chroot -C /destdir" will chroot to /destdir.
> 
> Nope... the chroot is always to the original current directory.
> the cd /destdir will be done before the chroot - but may be affected
> by the chroot ("." must be inside the chroot).

It sounds as though the current interaction between --chdir and -C is
not very useful.  One of the following might be better:

A) "--chroot" and "-C dir" args are allowed to be mixed in with
   filename args, and are interpreted strictly in the order
   specified on the command line.  This implies that
   "tar ... -C /destdir --chroot" means "chdir(/destdir); chroot(.)",
   and "tar ... --chroot -C /destdir" means "chroot(.); chdir(/destdir)".

B) "--chroot dir" takes a directory name as an arg, and does
   "chdir(dir); chroot(.)". --chroot may not appear mpre than once,
   and is not allowed to be mixed in with -C or file name args.  This
   implies that "tar ... -C /destdir --chroot ." is not allowed,
   and "tar ... --chroot /destdir" means "chdir(/destdir); chroot(.)".

Of course, just documenting "don't attempt to mix --chroot with -C"
might be good enough.

--apb (Alan Barrett)



Home | Main Index | Thread Index | Old Index