apko icon indicating copy to clipboard operation
apko copied to clipboard

orphaned files are silently dropped from db/apk/installed

Open smoser opened this issue 5 months ago • 0 comments

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:

  1. fail to install the apk that had "invalid" content in this case
  2. insert required path records and record the file.

smoser avatar Aug 12 '25 16:08 smoser