You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/03/29 19:46:50 UTC
[jira] Created: (COMPRESS-65) TarArchiveInputStream.matches() only
works for tar archives whose first file is "test1.xml"
TarArchiveInputStream.matches() only works for tar archives whose first file is "test1.xml"
-------------------------------------------------------------------------------------------
Key: COMPRESS-65
URL: https://issues.apache.org/jira/browse/COMPRESS-65
Project: Commons Compress
Issue Type: Bug
Reporter: Sebb
The tar header format does not have a "magic" number at the start, so in general it is impossible to tell if an input file is a tar file without reading a lot more data.
The current match() implementation assumes the first 8 bytes contain "test1.xml", which is obviously a hack for testing purposes.
If more bytes are read from the input, it might be possible to implement a working match() method:
The file must be at least 512 bytes long.
The following offsets have contents that could be checked:
Offset len
148 8 Checksum for header block
156 1 Link indicator (file type) - '0'-'6' or null
Other possible checks are:
- numeric fields must be octal
- filename fields must end in trailing nulls (but can a filename contain a null?)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (COMPRESS-65) TarArchiveInputStream.matches() only
works for tar archives whose first file is "test1.xml"
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved COMPRESS-65.
--------------------------
Resolution: Fixed
The match method now works for Posix and GNU.
> TarArchiveInputStream.matches() only works for tar archives whose first file is "test1.xml"
> -------------------------------------------------------------------------------------------
>
> Key: COMPRESS-65
> URL: https://issues.apache.org/jira/browse/COMPRESS-65
> Project: Commons Compress
> Issue Type: Bug
> Reporter: Sebb
>
> The tar header format does not have a "magic" number at the start, so in general it is impossible to tell if an input file is a tar file without reading a lot more data.
> The current match() implementation assumes the first 8 bytes contain "test1.xml", which is obviously a hack for testing purposes.
> If more bytes are read from the input, it might be possible to implement a working match() method:
> The file must be at least 512 bytes long.
> The following offsets have contents that could be checked:
> Offset len
> 148 8 Checksum for header block
> 156 1 Link indicator (file type) - '0'-'6' or null
> Other possible checks are:
> - numeric fields must be octal
> - filename fields must end in trailing nulls (but can a filename contain a null?)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.