alexcrichton / tar-rs

Tar file reading/writing for Rust
https://docs.rs/tar
Apache License 2.0
627 stars 190 forks source link

Extracting archive with symlink fails on Windows #268

Open suptejas opened 3 years ago

suptejas commented 3 years ago

I'm trying to extract https://registry.npmjs.org/swot-node/-/swot-node-2.0.173.tgz on Windows and I get this error while calling .unpack().

Custom { kind: Uncategorized, error: "A required privilege is not held by the client. (os error 1314) when symlinking hs-aalen.txt to C:\\Users\\xtrem\\.volt\\swot-node-2.0.173\\swot-node\\data\\lib\\domains\\de\\htw-aalen.txt" }

I've tried equivalent code in Python, Javascript and Golang, and they all seem to work fine.

Hope to get a bit of help with this! Thank you!

alexcrichton commented 3 years ago

That's most likely because there's a symlink somewhere in that tarball and this crate is trying to create a symlink but symlinks are weird on Windows. I don't know how other languages handle this but it could probably be implemented here, but would need some investigation.

suptejas commented 3 years ago

Sounds good! I posted the link to the tgz in the message on my issue so hopefully that could be used for debugging

konstin commented 9 months ago

Python's tarfile extractall copies the file instead of symlinking.