bin/145308: tar(1) -C functionality unused when -c or -r is specified

Garrett Cooper gcooper at FreeBSD.org
Fri Apr 2 23:20:07 UTC 2010


>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 at 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:


More information about the freebsd-bugs mailing list