/etc/apk/world can be wiped out if disk space runs out during "apk add"
apk opens the /etc/apk/world file with O_TRUNC. This means that if disk space runs out when it tries to write the file, the previous /etc/apk/world is lost. That means that the user can’t do an “apk del” to free up some space.
Might it be a better idea to write the new file out under a different name, and then rename it to “/etc/apk/world”? Or is there some other way to make this more robust?
If you would like to see this improved, I can submit a patch.
(from redmine: issue id 4207, created on 2015-05-18, closed on 2015-12-09)