Menu

TAR files - Wrong Magic Number

Shehi
2010-04-23
2012-12-08
  • Shehi

    Shehi - 2010-04-23

    I noticed TAR files created by 7-Zip have wrong "Magic number" when viewed by any Hex editor. TAR files usually should have x7573746172 bytes at offset 257. Another archiver IZArc is doing this correctly, however with 7-Zip this file signature is somehow omitted. The main reason I am bringing this up is that, most archives we download from net these days give "Header corrupt" errors when opened (with WinRAR or any other archiver) and fail to extract, however when you try 7-Zip, things work quite well. At first hand it might look as a good thing, but it is apparent that these "corrupted" archives are created with 7-Zip, which sometimes does not comply with standard file signatures. I want to urge you to make sure 7-Zip complies with these signature marks. For TAR file and other extensions you can check http://filext.com/file-extension/tar , tho I am sure you already are familiar with the concept and the implementation of it. Thanks and keep up good work! :)

    Shehi

     
  • Shehi

    Shehi - 2010-04-23

    Oh, I forgot to mention the difference between POSIX and GNU TAR signatures, they are "ustar\0" and "ustar\040\040\0" respectively. Almost all widely used file signatures can be found within any Linux distribution (location may vary, for Redhat Linux for example, it is /usr/share/magic).

    Shehi

     
  • Igor Pavlov

    Igor Pavlov - 2010-04-24

    7-Zip doesn't use USTAR.
    Write full information about problem case.
    Compress some file to .tar with 7-zip and extract it with WinRAR.
    And what version of WinRAR / 7-Zip?

     
  • Shehi

    Shehi - 2010-04-24

    I know it does not. Point is not reporting bug, but stating a possible problem - for example, I know file validators out there which check the integrity of file by viewing their signatures and accepting only those which pass (I am building one of those validators for as a project). Because 7-zip lacks proper signatures in its TAR archives and possibly in other archives it makes, files made by it will always become a pain in everyone's sides - yours as a developer, us as users. Why not use the proper file signature in first place, is what I don't get… That is why I encouraged you to use those magic numbers within your file structures. I don't mean your files don't work - they do - but it will be weird if some user one day encounters a "Your file is corrupt, thus can't be accepted" message and gets confused.

    Anyway, all I mean is : lets do whatever we do in the best possible way, thats all. Sorry if I offended in any way. Keep up good work! :)

     
  • Igor Pavlov

    Igor Pavlov - 2010-04-24

    USTAR is just some extension to TAR format.
    USTAR adds some fields that useless in Windows. Also it allows longer filenames, but these names are still limited.

    I suppose that 7-Zip creates correct .TAR archives.
    If you think that 7-Zip's TARs are incorrect, write more details.

     
  • Shehi

    Shehi - 2010-04-24

    :) No, your TARs are just fine and I am pretty sure you didn't get my meaning… I know at some point ustar signature is not vital, but it is essential for the reason I already mentioned above - your files might fail validation due to improper signing in some certain environments, as a result your software might get banned, or become unwelcome (trust me, it happens). I know its not a big deal, nothing bad can happen in grand scale, but I don't get this: IS IT SO HARD TO IMPLEMENT CORRECT SIGNATURE INTO FILES?! I know it is not, so why not to do that?! I am a user and as a user I need files created by 7zip to be compliant to the widely used standards out there (POSIX and GNU) - I expect, you, as a developer should consider this as a plus to your product and make it BETTER and MORE PERFECT (at least that's what I do). Other than that, 7zip works JUST fine, and I have nothing to say anymore on the topic.

    Shehi

     
  • johnjones

    johnjones - 2010-06-18

    Hey there

    I found this topic because I could not correctly decompress USTAR formatted archive

    I was faily sure that 7-ZIP would do tar files and I LOVE  7zip so I thought my friend was wrong however it turns out they where right and it actually not only fails to put the header into it's own tar files but it cant decompress standard ustar 

    I know it might not be needed as most software does not produce it but some do and rather than having to switch methods it would be wise to support the standard so that you can at least decompress these files on windows

    http://en.wikipedia.org/wiki/Tar_%28file_format%29

    regards

    John Jones

     
  • Igor Pavlov

    Igor Pavlov - 2010-06-18

    johnjones:
    Show some example of such archive.

     
  • Shehi

    Shehi - 2010-06-18

    No problem at my end in that regard… Just made a tar file on Fedora 8 system, and tested with 7-Zip, file gets opened without any complications. Of course, this is just one test, on one file only…

     
  • johnjones

    johnjones - 2010-06-21

    hey there

    I think the problem is related to utility producing standard tar files acording to ustar standard not all tar files

    well where would you like me to upload ustar file ?

    regards

    John Jones

     
  • Igor Pavlov

    Igor Pavlov - 2010-06-21

    You can create bug report and upload .tar file there.

     

Log in to post a comment.