Subject: Re: CVS commit: src/bin/pax
To: David Laight <david@l8s.co.uk>
From: Alan Barrett <apb@cequrux.com>
List: source-changes
Date: 10/19/2004 16:17:59
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)