guzba / zippy

Pure Nim implementation of deflate, zlib, gzip and zip.
MIT License
246 stars 29 forks source link

Keep symlink when uncompressing archive #18

Closed Clonkk closed 2 years ago

Clonkk commented 3 years ago

I've found that usiing Zippy to uncompress archive & tarball doesn't preserve symlink (which breaks some libraries package as archive)

guzba commented 3 years ago

Ah yeah I did not implement those in my first take. I'll investigate adding that.

Clonkk commented 3 years ago

That'd be awesome ! Zippy is a great package but this limitation prevents me from using it to uncompress shared library archive

guzba commented 2 years ago

Hello again. I've done more work on zip and tar stuff in zippy lately and wanted to look at adding symlink support for extracting tarballs.

Do you have a real-world tarball with symlinks in it that I could use for testing? I can make a fake one but I prefer testing with something "real" when I can (for example, I test with the Nim GitHub tarball and have also done the csources tarball).

If you do have a good test file to share that'd be great. Np if not I can just make or find one.

Also, I see on https://nim-lang.org/docs/os.html#createSymlink%2Cstring%2Cstring that creating a symlink, at least on Windows, is going to fail often due to lack of Administrator privilege. Is there something smarter I should do than just failing on error here?

Finally, there are also hard links. I'm not familiar with much use of them. Are they something I should be concerned with?

Clonkk commented 2 years ago

I had the issue with tarballs of Julia you can download at : https://julialang.org/downloads/ ;

I haven't tried on Windows and I don't know what it should do. I think a Windows archive simply shouldn't have symlink so returning an error should be fine ?

I've rarely seen hard links in archive. My use case case downloading library archive to distribute them with Nim code and it's mostly soft symlink for those.

guzba commented 2 years ago

Thanks for replying, your info was very helpful. The zippy/tarballs proc extractAll now supports symlinks in release >= 0.9.4. I am also using a tarball of Julia as my test file.

If you notice any issues with tarballs or symlinks just let me know. Once I have a test file for things they should not be hard to fix. Closing this issue for now but re-open if needed.