-
Notifications
You must be signed in to change notification settings - Fork 77
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
Ignore broken symlinks when compressing #224
Conversation
as an alternative we can add a flag to preserve symlinks |
Tar seems to support symlinks, but zip doesn't, so this flag would only work for tar? |
|
That doesn't mention broken symlinks explicitly and in practice if you try ziping a directory containing a broken symlink using |
I think I should then create an issue to add a |
I guess its a simple flag and can be added easily But I think it should be named -something like --dont--ignore--broken--symlinks My hunch is this is an advanced feature and the flag should be explicit like the above to show it Or another idea is to wait until somone open an issue about missing broken symlinks and explain his usecase, then it becomes obvious why we want this |
The former is about throwing errors when symlinks are broken, and the latter is about not following symlinks when creating archives, adding the symlinks instead of the files they point to. I think that the latter would be a more interesting and useful flag, could be named as |
So I did some testing and there is actually some weird edge cases in how
Since ouch already is similar to zip in this area, I guess adding |
Thanks for your research! |
/// Returns true if a path is a symlink. | ||
/// This is the same as the nightly https://doc.rust-lang.org/std/path/struct.Path.html#method.is_symlink | ||
// Useful to detect broken symlinks when compressing. (So we can safely ignore them) | ||
pub fn is_symlink(path: &Path) -> bool { | ||
fs::symlink_metadata(path).map(|m| m.file_type().is_symlink()).unwrap_or(false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol a couple months later this was stabilized.
No description provided.