Skip to content

Commit

Permalink
Drop --pkgid and --hdrid query source cli-switches
Browse files Browse the repository at this point in the history
These obscure switches are backed up by obsolete crypto that wont be,
cannot be, present in v6 packages. It would be possible to keep them
alive by making them point to non-obsolete data, but for that there
would need to be a use-case and users. These have neither as far as
I've learned in the last ~20 years.

Fixes: rpm-software-management#2633
  • Loading branch information
pmatilai committed Sep 26, 2024
1 parent bcf06fd commit 4087cf2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 60 deletions.
12 changes: 1 addition & 11 deletions docs/man/rpm.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ select-options

\[*PACKAGE\_NAME*\] \[**-a,\--all \[***SELECTOR*\]\] \[**-f,\--file
***FILE*\] \[**\--path ***PATH*\] \[**-g,\--group ***GROUP*\] \[**-p,\--package
***PACKAGE\_FILE*\] \[**\--hdrid ***SHA1*\] \[**\--pkgid ***MD5*\]
***PACKAGE\_FILE*\]
\[**\--tid ***TID*\] \[**\--querybynumber ***HDRNUM*\]
\[**\--triggeredby ***PACKAGE\_NAME*\] \[**\--whatprovides
***CAPABILITY*\] \[**\--whatrequires ***CAPABILITY*\]
Expand Down Expand Up @@ -638,11 +638,6 @@ name starts with \"b\".

: Query packages with the group of *GROUP*.

**\--hdrid ***SHA1*

: Query package that contains a given header identifier, i.e. the
*SHA1* digest of the immutable header region.

**-p, \--package ***PACKAGE\_FILE*

: Query an (uninstalled) package *PACKAGE\_FILE*. The *PACKAGE\_FILE*
Expand All @@ -664,11 +659,6 @@ name starts with \"b\".
Multiple packages may own a *PATH*, but the file is only owned by the
package installed last.

**\--pkgid ***MD5*

: Query package that contains a given package identifier, i.e. the
*MD5* digest of the combined header and payload contents.

**\--querybynumber ***HDRNUM*

: Query the *HDRNUM*th database entry directly; this is useful only
Expand Down
2 changes: 0 additions & 2 deletions include/rpm/rpmcli.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ enum rpmQVSources_e {
RPMQV_DBOFFSET, /*!< ... from database header instance. */
RPMQV_SPECRPMS, /*!< ... from spec file binaries (query only). */
RPMQV_SPECFILE = RPMQV_SPECRPMS, /*!< ... backwards compatibility */
RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */
RPMQV_TID, /*!< ... from install transaction id (time stamp). */
RPMQV_SPECSRPM, /*!< ... from spec file source (query only). */
RPMQV_WHATRECOMMENDS, /*!< ... from recommends db search. */
Expand Down
9 changes: 0 additions & 9 deletions lib/poptQV.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ struct rpmQVKArguments_s rpmQVKArgs;
#define POPT_QUERYBYNUMBER -1003
#define POPT_TRIGGEREDBY -1004
#define POPT_DUMP -1005
#define POPT_QUERYBYPKGID -1007
#define POPT_QUERYBYHDRID -1008
#define POPT_QUERYBYTID -1010
#define POPT_WHATRECOMMENDS -1011
#define POPT_WHATSUGGESTS -1012
Expand Down Expand Up @@ -62,8 +60,6 @@ static void rpmQVSourceArgCallback( poptContext con,
case POPT_WHATENHANCES: qva->qva_source |= RPMQV_WHATENHANCES; break;
case POPT_TRIGGEREDBY: qva->qva_source |= RPMQV_TRIGGEREDBY; break;
case POPT_QUERYBYPATH: qva->qva_source |= RPMQV_PATH_ALL; break;
case POPT_QUERYBYPKGID: qva->qva_source |= RPMQV_PKGID; break;
case POPT_QUERYBYHDRID: qva->qva_source |= RPMQV_HDRID; break;
case POPT_QUERYBYTID: qva->qva_source |= RPMQV_TID; break;
case POPT_QUERYBYNUMBER: qva->qva_source |= RPMQV_DBOFFSET; break;
}
Expand Down Expand Up @@ -92,11 +88,6 @@ struct poptOption rpmQVSourcePoptTable[] = {
{ "package", 'p', 0, 0, 'p',
N_("query/verify a package file"), NULL },

{ "pkgid", '\0', 0, 0, POPT_QUERYBYPKGID,
N_("query/verify package(s) with package identifier"), "MD5" },
{ "hdrid", '\0', 0, 0, POPT_QUERYBYHDRID,
N_("query/verify package(s) with header identifier"), "SHA1" },

{ "query", 'q', 0, NULL, 'q',
N_("rpm query mode"), NULL },
{ "querybynumber", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYNUMBER,
Expand Down
38 changes: 0 additions & 38 deletions lib/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ static rpmdbMatchIterator matchesIterator(rpmts ts, rpmDbiTag dbi,
static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * arg)
{
const char * s;
int i;
rpmdbMatchIterator mi = NULL;

if (qva->qva_showPackage == NULL)
Expand All @@ -331,43 +330,6 @@ static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * ar
}
break;

case RPMQV_PKGID:
{ unsigned char MD5[16];
unsigned char * t;

for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{};
if (i != 32) {
rpmlog(RPMLOG_ERR, _("malformed %s: %s\n"), "pkgid", arg);
goto exit;
}

MD5[0] = '\0';
for (i = 0, t = MD5, s = arg; i < 16; i++, t++, s += 2)
*t = (rnibble(s[0]) << 4) | rnibble(s[1]);

mi = rpmtsInitIterator(ts, RPMDBI_SIGMD5, MD5, sizeof(MD5));
if (mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"pkgid", arg);
}
} break;

case RPMQV_HDRID:
for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{};
if (i != 40) {
rpmlog(RPMLOG_ERR, _("malformed %s: %s\n"), "hdrid", arg);
goto exit;
}

mi = rpmtsInitIterator(ts, RPMDBI_SHA1HEADER, arg, 0);
if (mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"hdrid", arg);
}
break;

case RPMQV_TID:
{ char * end = NULL;
rpm_tid_t iid = strtoul(arg, &end, 0);
Expand Down

0 comments on commit 4087cf2

Please sign in to comment.