When the snap is refreshed and a new $SNAP_DATA/etc/ld.so.cache generated from the available libraries in the snap, by a post-refresh hook, the file found at /etc/ld.so.cache does not reflect the changes. The $SNAP_DATA file is successfully updated, but the mirror at /etc has the original file’s timestamp and content.
When you update the $SNAP_DATA/etc/ld.so.cache file content are you unlink’ing or removing the file first? If so, I don’t think you want to do that, as per @zyga-snapd’s explanation here, I think you instead probably want to totally overwrite that file rather than remove it or rename some other file to that $SNAP_DATA/etc/ld.so.cache. Or alternatively you could try using symlink instead of bind-file.
That’s a good question. I regenerate the file with ldconfig. I guess it must be internally unlinking the file. I’m going to try generating to a temporary file and then catting that into the bound file to see if that fixes it. Thanks for the insights