Fix "substatus" (eg NOKEY) regression on package read (#330)
Commit 3ccd9ccf50
introduced a regression
in the cases where package is successfully read (ie a header is returned)
but "there is a but", such as a missing pubkey. We need to return the
substatus instead of just "yes yes" in that case.
Keep track of the substatus in through the callback and return it
in case everything else was okay to restore former behavior.
This commit is contained in:
parent
2f99ec77b4
commit
e6c88eaeab
|
@ -266,6 +266,7 @@ void applyRetrofits(Header h, int leadtype)
|
|||
|
||||
struct pkgdata_s {
|
||||
const char *fn;
|
||||
rpmRC rc;
|
||||
};
|
||||
|
||||
static rpmRC handlePkgVS(struct rpmsinfo_s *sinfo, rpmRC rc, const char *msg, void *cbdata)
|
||||
|
@ -293,7 +294,11 @@ static rpmRC handlePkgVS(struct rpmsinfo_s *sinfo, rpmRC rc, const char *msg, vo
|
|||
|
||||
rpmlog(lvl, "%s: %s\n", pkgdata->fn, vsmsg);
|
||||
|
||||
/* Preserve traditional behavior for now: only failure prevents install */
|
||||
/* Remember actual return code, but don't override a previous failure */
|
||||
if (rc && pkgdata->rc != RPMRC_FAIL)
|
||||
pkgdata->rc = rc;
|
||||
|
||||
/* Preserve traditional behavior for now: only failure prevents read */
|
||||
if (rc != RPMRC_FAIL)
|
||||
rc = RPMRC_OK;
|
||||
|
||||
|
@ -307,6 +312,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
|
|||
rpmKeyring keyring = rpmtsGetKeyring(ts, 1);
|
||||
struct pkgdata_s pkgdata = {
|
||||
.fn = fn ? fn : Fdescr(fd),
|
||||
.rc = RPMRC_OK,
|
||||
};
|
||||
|
||||
/* XXX: lots of 3rd party software relies on the behavior */
|
||||
|
@ -315,6 +321,10 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
|
|||
|
||||
rpmRC rc = rpmpkgRead(keyring, vsflags, fd, handlePkgVS, &pkgdata, hdrp);
|
||||
|
||||
/* If there was a "substatus" (NOKEY in practise), return that instead */
|
||||
if (rc == RPMRC_OK && pkgdata.rc)
|
||||
rc = pkgdata.rc;
|
||||
|
||||
rpmKeyringFree(keyring);
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Reference in New Issue