Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Apr 2010 23:13:40 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/145308: tar(1) -C functionality unused when -c or -r is specified
Message-ID:  <201004022313.o32NDeIs067142@www.freebsd.org>
Resent-Message-ID: <201004022320.o32NK72Q025768@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         145308
>Category:       bin
>Synopsis:       tar(1) -C functionality unused when -c or -r is specified
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 02 23:20:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #5 r205310: Sat Mar 20 01:32:51 PDT 2010     gcooper@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA  amd64
>Description:
$ (cd /var/db/pkg/apr-gdbm-db42-1.3.9.1.3.9_1/ && tar -cvjf /dev/null . -C /tmp) > /dev/null
a .
a ./+CONTENTS
a ./+DESC
a ./+COMMENT
a ./+MTREE_DIRS
a ./+REQUIRED_BY

The following item fails to properly catch chdir fail on r205310's copy of tar(1) // libarchive:

$ (cd /var/db/pkg/apr-gdbm-db42-1.3.9.1.3.9_1/ && tar -cvjf /dev/null . -C /nonexistent/directory)
a .
a ./+CONTENTS
a ./+DESC
a ./+COMMENT
a ./+MTREE_DIRS
a ./+REQUIRED_BY
$

This should have failed immediately instead of continuing on.

-C with -r is also broken in a similar way:

$ (cd /var/db/pkg/apr-gdbm-db42-1.3.9.1.3.9_1/ && tar -rvf /tmp/foo . -C /tmp) > /dev/null
a .
a ./+CONTENTS
a ./+DESC
a ./+COMMENT
a ./+MTREE_DIRS
a ./+REQUIRED_BY

This issue has also been filed upstream in the Google Code project page so that it's visible to folks outside of FreeBSD as well as within FreeBSD:

http://code.google.com/p/libarchive/issues/detail?id=84
>How-To-Repeat:
(cd / && tar -cvf /dev/null . -C /tmp) - should pass and all of the contents of /tmp should be printed if /tmp exists

(cd / && tar -cvf /dev/null . -C /nonexistent/directory) - should flat out fail
tmpdir=$(mktemp -d /tmp.XXXX)

(cd / && tar -rf $tmpdir/foo -C /tmp) - should pass printing out the contents of /tmp again.
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004022313.o32NDeIs067142>