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

Allow overwriting symlinks #26

Merged
merged 1 commit into from
Aug 2, 2024
Merged

Conversation

lugray
Copy link
Contributor

@lugray lugray commented Apr 1, 2024

When extracting regular files, the file is opened for writing with os.O_TRUNC, making it suitable to extract over an existing file. This allows updating a local copy from an updated archive by extracting over it. If a link is added to the archive though, the second time it's extracted, an error occurs since os.Link and os.Symlink will not overwrite. This removes any file currently in place before attempting to write a link.

When extracting regular files, the file is opened for writing with
os.O_TRUNC, making it suitable to extract over an existing file. This
allows updating a local copy from an updated archive by extracting over
it. If a link is added to the archive though, the second time it's
extracted, an error occurs since os.Link and os.Symlink will not
overwrite. This removes any file currently in place before attempting to
write a link.
@cmaglie cmaglie merged commit 778355b into codeclysm:master Aug 2, 2024
@cmaglie
Copy link
Collaborator

cmaglie commented Aug 2, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants