apko
apko copied to clipboard
orphaned files are silently dropped from db/apk/installed
We have a test here that insists that "intermediate dirs in the tree should be required to preserve children"
{ name: "intermediate dirs in the tree should be required to preserve children", headers: []tar.Header{ {Name: "usr", Typeflag: tar.TypeDir}, {Name: "usr/bin", Typeflag: tar.TypeDir}, {Name: "etc", Typeflag: tar.TypeDir}, {Name: "etc/logrotate.d/file", Typeflag: tar.TypeReg}, {Name: "usr/bin/cmd", Typeflag: tar.TypeReg}, }, expected: []string{ "usr", "usr/bin", "usr/bin/cmd", }, },
But the thing that we do is just drop the entries from db/apk/installed. Which is kind of weird. Note also that this test insists we drop the now-empty /etc also, while the empty directory usr/bin gets through.
If an apk has a tar entry for the path "etc/logrotate.d/file", but no entry for "etc/logrotate.d", then our response is to not record the file in the apk installed database (/lib/db/apk/installed).
I asked @luhring if he remembered how that got there, or why it is needed. It seems maybe related to alpine apk support. It feels like it would be better to do either:
- fail to install the apk that had "invalid" content in this case
- insert required path records and record the file.