Add _xxx_fix_pkg_permissions to fix the libsa.3.gz and /root permissions in the target pkg database until pkg metalog generation is fixed upstream, pkg_db_vacuum to verify and compact the target pkg database after the manual SQL edits, and _xxx_pkg_add_var_db_files_to_metalog to add the generated /var/db/pkg files to the metalog.
Also document _xxx_pkg_metalog's existing permission fixups by referencing the same upstream pkg issue.