[Rpm-maint] [rpm-software-management/rpm] Allow database probing if _db_backend is not set (#1451)
Panu Matilainen
notifications at github.com
Thu Dec 3 09:25:46 UTC 2020
@pmatilai commented on this pull request.
> @@ -97,7 +98,7 @@ dbDetectBackend(rpmdb rdb)
rpmlog(RPMLOG_WARNING,
_("Converting database from %s to %s backend\n"),
ondisk->name, cfg->name);
- } else {
+ } else if (*db_backend) {
Right, it does look a kinda suspect that way.
I can see how rpmdb2solv doesn't want that warning to be emitted, because it *wants* rpm to do a probe. But shouldn't this actually be:
```
/* On-disk database differs from configuration */
if (ondisk && ondisk != cfg) {
if (cfg) {
if (rdb->db_flags & RPMDB_FLAG_REBUILD) {
rpmlog(RPMLOG_WARNING,
_("Converting database from %s to %s backend\n"),
ondisk->name, cfg->name);
} else {
rpmlog(RPMLOG_WARNING,
_("Found %s %s database while attempting %s backend: "
"using %s backend.\n"),
ondisk->name, ondisk->path, db_backend, ondisk->name);
}
}
rdb->db_ops = ondisk;
}
```
Ie the warnings should only ever be emitted when there *is* a configuration, and I think conditionalizing on 'cfg' makes it more clear than the various different conditions (eg the `cfg->name` access *looks* like potential a NULL-pointer dereference now, that its guarded by RPMDB_FLAG_REBUILD is not immediately obvious, and looking at *db_backend is different from all the other surrounding conditions). Or am I missing something? (this is a surprisingly subtle little thing)?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1451#discussion_r534995527
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20201203/4353ad04/attachment.html>
More information about the Rpm-maint
mailing list