`xbps-reconfigure -fa` on a fresh install adds (missing?) `pkgname` entries to `pkgdb-0.38.plist`
Not sure if this is a bug or not, but I thought better report it, in case it is.
I noticed that when creating a new chroot by running: xbps-install -S -r ./testroot -C /usr/share/xbps.d base-system, there are no <key>pkgname</key><string>...</string> entries in pkgdb-0.38.plist.
However when I run: chroot ./testroot xbps-reconfigure -fa
then ./testroot/var/db/xbps/pkgdb-0.38.plist does contain those entries. It contains exactly as many as there are packages in the chroot installed, so I assume for every package entry in pkgdb-0.38.plist one of those entries is added.
I was wondering why the xbps-install command was not creating them in the first place... (I did not supply the -U flag to that)
I think it was supposed to not add the pkgname field to the pkgdb, when xbps-install installs/updates a package it uses the xbps_pkg_register function to store the metadata in the pkgdb, in that function the pkgname key is removed: https://github.com/void-linux/xbps/blob/ba36b19163a2a2c0a0aa3f088d4d7fbb23084117/lib/package_register.c#L110
In other places where xbps might write the pkgdb back to disk (like setting the package state from "half-installed" to installed in xbps-reconfigure's case) it will write all the packages with its pkgname field to disk.
Would probably make sense to just not delete the pkgname key, since the opposite of making sure its gone before saving the pkgdb is a lot more work.