[Rpm-maint] [rpm-software-management/rpm] Implement a separate lock for the keystore (PR #4123)
Michal Domonkos
notifications at github.com
Tue Apr 21 09:59:35 UTC 2026
@dmnks commented on this pull request.
Overall LGTM, some nitpicks inline.
> @@ -318,13 +330,29 @@ rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
return rc;
}
-rpmRC rpmtxnImportPubkey(rpmtxn txn, const unsigned char * pkt, size_t pktlen)
+static rpmtxn ensureKxn(rpmtxn txn, const char *fname)
+{
+ rpmtxn kxn = NULL;
Cosmetic: We could maybe just use `return` below, and thus get rid of the else branch (and the slightly confusing `kxn = txn` assignment) 😅
> @@ -318,13 +330,29 @@ rpmRC rpmtsImportHeader(rpmtxn txn, Header h, rpmFlags flags)
return rc;
}
-rpmRC rpmtxnImportPubkey(rpmtxn txn, const unsigned char * pkt, size_t pktlen)
+static rpmtxn ensureKxn(rpmtxn txn, const char *fname)
+{
+ rpmtxn kxn = NULL;
+ if (txn && txn->txntype != TXN_KEYRING) {
It seems like we actually have the type information captured already, in the form of `ts->kslock` that gets set through `rpmkxnBegin()`. So in this function, we could just compare the passed `txn` with `ts->kslock`, and thus not need the `txntype` enum, no?
> {
- rpmts ts = rpmtxnTs(txn);
+ rpmtxn txn = ensureKxn(kxn, __func__);
+ rpmts ts = rpmtxnTs(kxn);
Shouldn't this line have `rpmtxnTs(txn)` instead (i.e. without a change)? AFAICT, it doesn't really matter since it's the same `ts` instance in both cases, but from the readability aspect...
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4123?email_source=notifications&email_token=ADLPZU7OV3Q7AQUGQFQFEYT4W5BAPA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMJUGY3DANZXGAZ2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#pullrequestreview-4146607703
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/4123/review/4146607703 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260421/5a82249a/attachment-0001.htm>
More information about the Rpm-maint
mailing list