Skip to content

database: move lock file from /lib/apk to /run/apk

/lib is only supposed to hold essential shared libraries and kernel modules. The lock file is part of the state information of the application. And could also live under /var/lib/apk/db/lock. However, given that there is a directory specific to hold runtime data, let's put it in there.

In the process, implement some basic fallback to the old lockfile, and force creating the new one if the old one doesn't exist. With this new location, we don't need to check for APK_OPENF_CREATE when requesting the lock file. The directory where the new lock lives is not related to the DB, and if we are using the old lock file location, it is because it already exists!

This is a partial revert of 57de8d0c, but the problem identified there should not be an issue when writing directly to /run

Merge request reports

Loading