You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2016/05/20 16:46:12 UTC

[jira] [Resolved] (COMPRESS-356) PAX header entry name ending with / causes problems

     [ https://issues.apache.org/jira/browse/COMPRESS-356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved COMPRESS-356.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.12

Thanks a lot.

Commit 823cdee contains a slightly modified version of your patch. If manually created an archive for the test case - Emacs hexl-mode to the rescue :-)


> PAX header entry name ending with / causes problems
> ---------------------------------------------------
>
>                 Key: COMPRESS-356
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-356
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.11
>            Reporter: Jeremy Gustie
>             Fix For: 1.12
>
>
> There seems to be a problem when a PAX header entry (link flag is 'x') has a name ending with "/". The {{TarArchiveEntry.isDirectory()}} check ends up returning {{true}} because of the trailing slash which means no content can be read from the entry. PAX header parsing effectively finds nothing and the stream is not advanced; this leaves the stream in a bad state as the next entry's header is actually read from the header contents.
> If the name is modified to remove the trailing slash when the link flag indicates a PAX header everything seems to work fine. That would be one potential fix in {{parseTarHeader}}. Changing {{isDirectory}} to return {{false}} if {{isPaxHeader}} is {{true}} (before the trailing "/" check) would probably also fix the issue (though I can't verify that in the debugger like I can with changing the name).
> So far I have only seen this when using Docker to save images that contain a yum database. For example:
> {noformat}
> docker pull centos:latest && docker save centos:latest | tar x --include "*/layer.tar"
> {noformat}
> Will produce at least one "layer.tar" that exhibits this issue. If I come across a smaller TAR for testing I will attach it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)