Hey Bryan,
For clarification: are you running into this issue when opkg is running
in a rootfs context in OE, or after booting into the built image?
On 2/28/22 14:30, Bryan Evenson wrote:
> I have a little more information. For the base-files ipk and for the
> created image, /tmp is a directory and not a softlink. There are init
> scripts that will force /tmp to be a softlink to /var/tmp. Is it
> possible this is causing problems for remove_obsolesced_files()?
My reading of `remove_obsolesced_files()` suggests that it does not
consider link targets at all when determining if a file should be
removed (which seems reasonable). So presumably, `/tmp` being a link
shouldn't trigger its removal.
>
> Thanks,
> Bryan
>
> On Mon, Feb 28, 2022 at 8:38 AM Bryan Evenson <
evenso...@gmail.com>
> wrote:
>
> I see something different with /tmp that might be the issue. /tmp
> is not a directory; it is a softlink to /var/tmp, which is then a
> softlink to /var/volatile/tmp, which is then a directory. /tmp,
> /var/tmp and /var/volatile/tmp are all listed in the output from
> 'opkg files base-files'. I've been trying to debug
> remove_obsolesced_files() in opkg_install.c, but I don't see any
> more verbose debug messages without adding my own and
> recompiling. I thought hash_table_get() on line 719 would find
> /tmp but it appears that is not the case. Any ideas on what else
> to try?
>
I would have expected that as well. Line 708 in that function [1] has a
suspiscious `20` magic number in it that gets assigned to the
`n_buckets` property of the FILES hash table. I would have expected that
to be the size of the backing array used to resolve hash collisions in
the table.... But reading the hash table source has me thinking that it
might be being used to statically size the number of keys in the hash
table? I'm probably just rusty on my C and misinterpreting the data
structure, but its worth checking that opkg isn't trying to store FILE
lists into a 20-entry static hash table. Because if it is, I can see a
large package like base-files easily breaking that limit and then this
whole function would start behaving weirdly.
I think you need to compile in some debug statements and get an
understanding of the logic that opkg is testing in
`remove_obsolesced_files()`. One of the `if (new)... if (file_is_dir...
if (owner...` checks in there should be catching the similar path and
avoiding its deletion.
You might also learn something by trying to reproduce this error in a
test case. If it doesn't reproduce there, it points to something unique
about the `base-files` package or the OE built image.
> --
> You received this message because you are subscribed to the Google
> Groups "opkg-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
opkg-devel+...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/opkg-devel/CAOfHXQzq2XYHCyZsuzkj9ZdwN%2Bs06%3DV0qfyB7xVUPy1s-LfDgw%40mail.gmail.com
> <
https://urldefense.com/v3/__https://groups.google.com/d/msgid/opkg-devel/CAOfHXQzq2XYHCyZsuzkj9ZdwN*2Bs06*3DV0qfyB7xVUPy1s-LfDgw*40mail.gmail.com?utm_medium=email&utm_source=footer__;JSUl!!FbZ0ZwI3Qg!8thyCf63rKiFyNGr80dVKvOhhCoNqXsODXoj2hzr64JdelXdiS82FPH7AcHgCZA$>.
[1]
https://git.yoctoproject.org/opkg/tree/libopkg/opkg_install.c?id=b52c702d0c6e00b3304ac26d517f9a93b63db1c8#n708
Hope that helps,
--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)
alex.s...@ni.com