Subject: bin/30132: Something is wrong with tar(1) --chroot
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <juan@xtrarom.org>
List: netbsd-bugs
Date: 05/04/2005 15:10:00
>Number:         30132
>Category:       bin
>Synopsis:       Something is wrong with tar(1) --chroot
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 04 15:10:00 +0000 2005
>Originator:     juan@xtrarom.org
>Release:        NetBSD 3.99.3
>Organization:
>Environment:
System: NetBSD xenun 3.99.3 NetBSD 3.99.3 (XenU) #11: Tue May 3 15:42:35 CEST 2005 juan@Nocturno:/home/juan/build/obj/sys/arch/i386/compile/XenU i386
Architecture: i386
Machine: i386
>Description:

	tar --chroot doesn't work correctly with last changes:

[juan@Nocturno][~/FOOBAR]> sudo tar --chroot -zxehvpf xtar.tar.gz   
xtar
tar: Attempt to write file `/xtar' outside current working directory `/home/juan/FOOBAR' ignored
xtar/xtar.c
tar: Attempt to write file `/xtar' outside current working directory `/home/juan/FOOBAR' ignored
tar: Cannot resolve `xtar/xtar.c'
xtar/xtar.h
tar: Attempt to write file `/xtar' outside current working directory `/home/juan/FOOBAR' ignored
tar: Cannot resolve `xtar/xtar.h'
xtar/Makefile
tar: Attempt to write file `/xtar' outside current working directory `/home/juan/FOOBAR' ignored
tar: Cannot resolve `xtar/Makefile'
tar: ustar vol 1, 4 files, 20480 bytes read, 0 bytes written in 1 secs (20480 bytes/sec)
[juan@Nocturno][~/FOOBAR]>

/bin/tar:
     $NetBSD: crt0.c,v 1.13 2003/07/26 19:24:27 salo Exp $
     $NetBSD: ar_io.c,v 1.44 2004/08/02 10:20:48 yamt Exp $
     $NetBSD: ar_subs.c,v 1.35 2005/01/23 06:19:03 jmc Exp $
     $NetBSD: buf_subs.c,v 1.25 2004/09/22 14:51:12 christos Exp $
     $NetBSD: cpio.c,v 1.18 2005/02/04 00:38:15 matt Exp $
     $NetBSD: file_subs.c,v 1.52 2004/09/22 15:03:18 christos Exp $
     $NetBSD: ftree.c,v 1.32 2004/07/02 16:26:53 christos Exp $
     $NetBSD: gen_subs.c,v 1.32 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: getoldopt.c,v 1.20 2004/06/20 22:20:14 jmc Exp $
     $NetBSD: options.c,v 1.83 2005/02/10 17:48:33 jmc Exp $
     $NetBSD: pat_rep.c,v 1.23 2005/01/23 06:19:03 jmc Exp $
     $NetBSD: pax.c,v 1.36 2004/10/10 21:53:23 christos Exp $
     $NetBSD: sel_subs.c,v 1.19 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: tables.c,v 1.23 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: tar.c,v 1.61 2005/02/20 07:35:47 christos Exp $
     $NetBSD: tty_subs.c,v 1.17 2004/10/10 21:54:24 christos Exp $
     $NetBSD: spec.c,v 1.59 2004/12/01 23:27:36 lukem Exp $
     $NetBSD: misc.c,v 1.25 2004/06/20 22:20:18 jmc Exp $
     $NetBSD: stat_flags.c,v 1.19 2004/05/25 14:54:55 hannken Exp $
     $NetBSD: pack_dev.c,v 1.8 2004/05/11 17:09:58 christos Exp $
     $NetBSD: rmtlib.c,v 1.19 2003/03/08 07:47:49 lukem Exp $


An old version (1 month ago more or less) seems to work fine:

[juan@Mandylion][~/FOOBAR]> sudo tar --chroot -xvzhepf xtar.tar.gz            
xtar
xtar/xtar.c
xtar/xtar.h
xtar/Makefile
tar: ustar vol 1, 4 files, 20480 bytes read, 0 bytes written in 1 secs (20480 bytes/sec)
[juan@Mandylion][~/FOOBAR]> ident `which tar`
/bin/tar:
     $NetBSD: crt0.c,v 1.13 2003/07/26 19:24:27 salo Exp $
     $NetBSD: ar_io.c,v 1.44 2004/08/02 10:20:48 yamt Exp $
     $NetBSD: ar_subs.c,v 1.35 2005/01/23 06:19:03 jmc Exp $
     $NetBSD: buf_subs.c,v 1.25 2004/09/22 14:51:12 christos Exp $
     $NetBSD: cpio.c,v 1.18 2005/02/04 00:38:15 matt Exp $
     $NetBSD: file_subs.c,v 1.52 2004/09/22 15:03:18 christos Exp $
     $NetBSD: ftree.c,v 1.32 2004/07/02 16:26:53 christos Exp $
     $NetBSD: gen_subs.c,v 1.32 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: getoldopt.c,v 1.20 2004/06/20 22:20:14 jmc Exp $
     $NetBSD: options.c,v 1.83 2005/02/10 17:48:33 jmc Exp $
     $NetBSD: pat_rep.c,v 1.23 2005/01/23 06:19:03 jmc Exp $
     $NetBSD: pax.c,v 1.36 2004/10/10 21:53:23 christos Exp $
     $NetBSD: sel_subs.c,v 1.19 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: tables.c,v 1.23 2003/10/27 00:12:41 lukem Exp $
     $NetBSD: tar.c,v 1.61 2005/02/20 07:35:47 christos Exp $
     $NetBSD: tty_subs.c,v 1.17 2004/10/10 21:54:24 christos Exp $
     $NetBSD: spec.c,v 1.59 2004/12/01 23:27:36 lukem Exp $
     $NetBSD: misc.c,v 1.25 2004/06/20 22:20:18 jmc Exp $
     $NetBSD: stat_flags.c,v 1.19 2004/05/25 14:54:55 hannken Exp $
     $NetBSD: pack_dev.c,v 1.8 2004/05/11 17:09:58 christos Exp $
     $NetBSD: rmtlib.c,v 1.19 2003/03/08 07:47:49 lukem Exp $
[juan@Mandylion][~/FOOBAR]>

>How-To-Repeat:
>Fix: