-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre-POSIX.1-1988 (i.e. v7) tar header #76
Comments
Should be simple. Can libmagic (file cmd) recognize this? |
Yes, here the output: xflofoxx@mypc:~% file compressed.tar.bz2 |
BZ2 is another format with its own magic header, right? |
Yes, sorry, let me explain better. My first idea was to ask the library file-type. If correct identification wasn't possible then I would have asked the decompress lib to introduce a check such as "bypass tar check". So, the bz2 format is correctly identified but the nested tar content not. |
Ok, then please try to run "file" on the nested tar content instead of the bz2 |
xflofoxx@mypc:~% bunzip2 compressed.tar.bz2 xflofoxx@mypc:~% file compressed.tar |
as far as i can see, file-type should already recognize tar, are you sure that it does not? |
At line 102 there is this check: If I create a new tar I get the right format. The one I try to untar is a file taken from a fire detection system. The strange thing is that I can untar it like the one I create but the checked bytes have the following values:
Do you think it's possible to identify the file the same? |
For completeness, if I save the buffer from the library into a tar file "manually" the response of the file cmd is "data" and not "tar archive". |
From https://github.com/threatstack/libmagic/blob/master/magic/Magdir/archive: I found some code here: however i don't have time to analyze how it works now, feel free to try :) |
Wow... thanks a lot! |
Actually the code can be borrowed from node-tar to decode the header of tar buffer and check the value of cksumValid, if there is no magic bytes at offset 257 in the header. |
@IssueHunt has funded $40.00 to this issue.
|
@sindresorhus has rewarded $36.00 to @stroncium. See it on IssueHunt
|
Hi, is it possible to add the headers for Pre-POSIX.1-1988 (i.e. v7) tar recognition?
Reference here: https://en.wikipedia.org/wiki/Tar_(computing)#cite_note-2
Thanks in advice!
The text was updated successfully, but these errors were encountered: