Skip to content

Allow overwriting symlinks#26

Merged
cmaglie merged 1 commit into
codeclysm:masterfrom
lugray:symlink_overwrite
Aug 2, 2024
Merged

Allow overwriting symlinks#26
cmaglie merged 1 commit into
codeclysm:masterfrom
lugray:symlink_overwrite

Conversation

@lugray
Copy link
Copy Markdown
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
Copy Markdown
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