Skip to content
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

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

Closed
1 of 8 tasks
alexmbaker opened this issue Jul 6, 2016 · 1 comment
Closed
1 of 8 tasks
Assignees
Labels
bug tar Related to TAR file format
Milestone

Comments

@alexmbaker
Copy link

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
@McNeight McNeight added bug tar Related to TAR file format labels Aug 6, 2016
@McNeight McNeight added this to the 1.0 milestone Aug 6, 2016
@McNeight McNeight self-assigned this Aug 6, 2016
@siegfriedpammer
Copy link
Member

I tried reproducing this bug. I extracted npm-3.10.3.tgz using 7zip and TarArchive.ExtractContents and both directory structures are identical. Can you provide a dump of the directory structure you are getting? What code are you using to extract the files?

piksel added a commit to piksel/SharpZipLib that referenced this issue Jul 1, 2018
piksel added a commit to piksel/SharpZipLib that referenced this issue Jul 1, 2018
Fixes icsharpcode#121
Only "path" keyword supported as it's used for non-GNU long file names.
@piksel piksel self-assigned this Jul 1, 2018
piksel added a commit that referenced this issue Jul 12, 2018
Fixes #121
Only "path" keyword supported as it's used for non-GNU long file names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug tar Related to TAR file format
Projects
None yet
Development

No branches or pull requests

4 participants