Skip to content

Commit

Permalink
Having no keys imported is not an error
Browse files Browse the repository at this point in the history
...any more than "ls" in an empty directory is. We should fix this
in 4.20 too before people start making assumptions about this behavior.
  • Loading branch information
pmatilai committed Oct 15, 2024
1 parent b2fd4eb commit b1fcbea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
5 changes: 2 additions & 3 deletions tests/rpmdb.at
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,8 @@ runroot rpmkeys --delete 757bf69e
runroot rpmkeys --delete eb04e625
runroot rpmkeys --list
],
[1],
[No keys installed
],
[0],
[],
[])
RPMTEST_CLEANUP

Expand Down
8 changes: 2 additions & 6 deletions tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,10 @@ runroot rpmkeys --delete 1964c5fc
[])

RPMTEST_CHECK([
# XXX rpmkeys on rpmdb returns "package gpg-pubkey is not installed" with
# and error code when no keys are present, paper over
runroot rpmkeys --list | grep -v "No keys installed" | wc -l
exit 0
runroot rpmkeys --list
],
[0],
[0
],
[],
[])
RPMTEST_CLEANUP

Expand Down
6 changes: 0 additions & 6 deletions tools/rpmkeys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,12 @@ static int matchingKeys(rpmKeyring keyring, ARGV_const_t args, void * userdata,
}
}
} else {
int found = false;
auto iter = rpmKeyringInitIterator(keyring, 0);
rpmPubkey key = NULL;
while ((key = rpmKeyringIteratorNext(iter))) {
found = true;
callback(key, userdata);
}
rpmKeyringIteratorFree(iter);
if (!found) {
rpmlog(RPMLOG_NOTICE, "No keys installed\n");
ec = EXIT_FAILURE;
}
}
return ec;
}
Expand Down

0 comments on commit b1fcbea

Please sign in to comment.