DockerCLI/cli/context
Nick Santos 57a502772b
context: avoid corrupt file writes
Write to a tempfile then move, so that if the
process dies mid-write it doesn't corrupt the store.

Also improve error messaging so that if a file does
get corrupted, the user has some hope of figuring
out which file is broken.

For background, see:
https://github.com/docker/for-win/issues/13180
https://github.com/docker/for-win/issues/12561

For a repro case, see:
https://github.com/nicks/contextstore-sandbox

Signed-off-by: Nick Santos <nick.santos@docker.com>
(cherry picked from commit c2487c2997)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-01 16:14:03 +01:00
..
docker format (GoDoc) comments with Go 1.19 to prepare for go updates 2022-07-19 19:10:16 +02:00
store context: avoid corrupt file writes 2023-03-01 16:14:03 +01:00
endpoint.go Fast Context Switch: commands 2019-01-10 22:25:43 +01:00
tlsdata.go cli/context/store: simplify error handling, and make it more idiomatic 2022-09-30 11:19:25 +02:00