ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Add `--store-symlinks` flag to the `compress` command

Open marcospb19 opened this issue 4 years ago • 4 comments

Currently, when compressing, ouch always follows symlinks when building an archive, ignoring errors when they occur, meaning there is no way to store a symlink inside of an archive.

The -s/--store-symlinks (possibly with an --symlink alias), would not follow symlinks, but store them directly into the archives (.tar and .zip support this kind of opertation).

Also in case of broken links, it should fail and thrown an error, instead of ignoring them.

(Continuation of the discussion of #224)

marcospb19 avatar Dec 15 '21 07:12 marcospb19

the zip library we are using currently doesn't support symlinks (implementation is in progress, see https://github.com/zip-rs/zip/issues/77)

also i think broken symlinks should be kept with --store-symlinks, perhaps with warnings

figsoda avatar Sep 01 '22 19:09 figsoda

Thanks for the update, yeah I agree, warnings are more than enough.

marcospb19 avatar Sep 01 '22 20:09 marcospb19

The zip library was updated 4 days ago, and added the function add_symlink to ZipWriter:

https://docs.rs/zip/latest/zip/write/struct.ZipWriter.html#method.add_symlink

Do we need to validate if all symlinks point to a file inside of the archive that is being built?

marcospb19 avatar Oct 17 '22 03:10 marcospb19

Didn't know zip got an update, good to know!

I think we could throw a warning for broken links and output a different info message for all symlinks, I don't know if we should treat files that point to outside of the archive

figsoda avatar Oct 17 '22 13:10 figsoda