Skip to content

TAR in ustar format with long file names: TarEntry name is incomplete #121

@alexmbaker

Description

@alexmbaker

Steps to reproduce

  1. Obtain a TAR with long file names - eg http://registry.npmjs.org/npm/-/npm-3.10.3.tgz
  2. Follow the directions to extract from the archive provided in the project WiKi https://github.com/icsharpcode/SharpZipLib/wiki/GZip-and-Tar-Samples#-simple-full-extract-from-a-tgz-targz
  3. Run the extract

Expected behavior

The files should be extracted in the same folder structure as it would be using 7Zip. The extracted should look something like

.-- package
     |-- bin
     +-- node_modules
     |    |-- abbrev
     |    |--   
     |    +-- read-package-json
     |    +-- etc etc

Actual behavior

Where the file names including the relative path is long the files are extracted in the wrong place

.-- package
|    |-- bin
|    +-- node_modules
|    |    |-- abbrev
|    |    |--    
|
|-- read-package-json
|-- etc etc

Additional Information

The code in TarInputStream.GetNextEntry appears to only try to read the additional information if the header has a typeFlag equivelent to L. Looking at this documentation https://www.gnu.org/software/tar/manual/html_chapter/tar_14.html it appears different versions of the format do different things. The implementation in SharpZipLib appears to follow the 'old gnu' way but does have support for the new / current way which appears to be to read the field and see what is there.

Version of SharpZipLib

SharpZipLib.0.86.0

Obtained from (place an x between the brackets for all that apply)

  • Compiled from source
    • branch: _______
    • commit: _______
  • Downloaded DLL from GitHub
  • Downloaded DLL from SourceForge
  • Downloaded DLL from _______
  • DLL included as part of
  • Package installed using:
    • NuGet
    • MyGet
    • Chocolatey

Metadata

Metadata

Labels

bugtarRelated to TAR file format

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions