Skip to content

fix: truncate template files while pulling #16474

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

Merged
merged 2 commits into from
Feb 6, 2025
Merged

fix: truncate template files while pulling #16474

merged 2 commits into from
Feb 6, 2025

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Feb 6, 2025

Fixes: #16414

Function provisionersdk.Untar should truncate existing files. Otherwise, there is a risk that the pulled file may contain leftovers from its previous revision (if it is longer).

@mtojek mtojek self-assigned this Feb 6, 2025
@mtojek mtojek marked this pull request as ready for review February 6, 2025 12:18
@mtojek mtojek requested a review from johnstcn February 6, 2025 12:18
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already warn the user that existing files may be overwritten 👍

> Directory "/home/coder/tmp/scratch" is not empty, existing files may be overwritten.
Continue extracting? (yes/no) yes
Extracting template to "/home/coder/tmp/scratch"

@mtojek mtojek enabled auto-merge (squash) February 6, 2025 12:30
@mtojek mtojek merged commit 9da9c2f into main Feb 6, 2025
30 checks passed
@mtojek mtojek deleted the 16414-truncate branch February 6, 2025 12:40
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder templates pull doesn't truncate files when overwriting existing files but new contents are shorter
2 participants