Bug #5074
Updated by Tom Clegg about 9 years ago
The current code creates a race condition while writing a file. It should create a temp file, write it, flush/close it, and rename it into place. If anything fails, it should delete the temp file.
Additionally, if a cache file exists (and is new enough, etc.) but is unreadable or unparseable, the SDK crashes. Instead, it should print a warning, then retrieve the discovery document from the server and continue.
See source:sdk/cli/bin/arv#L55 and source:sdk/ruby/lib/arvados.rb#L108
Bonus points: de-duplicate this copy-and-pasted code!