Skip to content

ngclient: Write downloaded targets atomically - #3062

Open
FayezBast wants to merge 1 commit into
theupdateframework:developfrom
FayezBast:fix/atomic-target-write
Open

FayezBast wants to merge 1 commit into
theupdateframework:developfrom
FayezBast:fix/atomic-target-write

Conversation

@FayezBast

Copy link
Copy Markdown

Description of the changes being introduced by the pull request

Updater.download_target() writes verified downloads directly to the destination. If the copy fails partway through, such as when the disk fills, the previous target can be left truncated or partially overwritten.

This change stages regular target files on the destination filesystem and publishes them with os.replace() after the copy succeeds. A regression test simulates a disk-full error and verifies that the previous file stays intact and the temporary files are removed.

Testing

All 212 unit tests passed. Ruff, mypy, and the Sphinx build also passed.

Related to #2836, where staging target downloads on the same filesystem was proposed.

Signed-off-by: FayezBast <fayezbast15@gmail.com>
@FayezBast
FayezBast requested a review from a team as a code owner November 25, 2026 23:57

This branch has not been deployed

No deployments
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.

1 participant