Bug 197371 - tar -X does not allow empty file
Summary: tar -X does not allow empty file
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-06 13:18 UTC by Rudolf Čejka
Modified: 2018-11-02 12:31 UTC (History)
2 users (show)

See Also:


Attachments
archive_match.c.diff (874 bytes, patch)
2015-02-06 13:18 UTC, Rudolf Čejka
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolf Čejka 2015-02-06 13:18:08 UTC
Created attachment 152617 [details]
archive_match.c.diff

Please see https://code.google.com/p/libarchive/issues/detail?id=401

What steps will reproduce the problem?

1. Create empty file: touch z

2. Run: tar -tf/dev/null -X z

What is the expected output? What do you see instead?

What version are you using?

bsdtar 2.8.5 - libarchive 2.8.5 (as is in FreeBSD 9.3):

$ tar -tf/dev/null -X z
$

... empty output, good

bsdtar 3.1.2 - libarchive 3.1.2 (as is in FreeBSD 10.1):

$ tar -tf/dev/null -X z
tar: Error : Unrecognized archive format
$

Warning: The error is not about /dev/null archive format - it is about empty file z archive format, so the error is very misleading. File z could not be any archive in any case. You can try it with real tar file and you will suffer the same results.

I do not have deep knowledge of libarchive internals and reading of exclude list seems to be over-complicated to me, so I'm not sure about the correct solution, but something is included here.
Comment 1 Rodrigo Osorio freebsd_committer freebsd_triage 2015-02-06 14:42:49 UTC
Hi Rudolf,

Apparently this issue was resolved 27 days ago by this commit[1],
and looks like the bug reports the same issue[2].

At this point no new release of libarchive is available,
probably a new version is required for HEAD and 10-stable
in order to fix this issue.

Hope this help.
- rodrigo

[1] https://github.com/libarchive/libarchive/commit/f93e32f4a2e4b67b05d9042346439c169c03a39d
[2] https://code.google.com/p/libarchive/issues/detail?id=327
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2018-11-02 12:31:38 UTC
This works as expected on >= 11.2 with bsdtar >= 3.3.2.