diff --git a/tools/disk_cache/implementation.go b/tools/disk_cache/implementation.go index 0fb7e26c2..910c6b647 100644 --- a/tools/disk_cache/implementation.go +++ b/tools/disk_cache/implementation.go @@ -296,6 +296,9 @@ func (dc *DiskCache) add(key string, items map[string][]byte) (err error) { } changed -= before } else { + // unlink the file so that writing to it does not change a + // previously linked copy created by get() + _ = os.Remove(p) if err = os.WriteFile(p, data, 0o700); err != nil { return }