Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1402856

Summary: SRPM package should be installed when specified with '-F|--freshen' option ?
Product: Red Hat Enterprise Linux 7 Reporter: Masaki Furuta ( RH ) <mfuruta>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: ffesti, pmatilai
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-12 14:42:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851    

Description Masaki Furuta ( RH ) 2016-12-08 13:23:15 UTC
Description of problem:
   SRPM package should be installed when specified with '-F|--freshen' option ?
  
Version-Release number of selected component (if applicable):
  Fedora, RHEL.
  
How reproducible:
  Always, 100%
  
Steps to Reproduce:

1. customer had extracted all of hotfix packages we provided in the archive.
  
  # ls
  openstack-neutron-2015.1.4-11.el7ost.noarch.rpm                 openstack-neutron-ml2-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-2015.1.4-11.el7ost.src.rpm                    openstack-neutron-nec-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-bigswitch-2015.1.4-11.el7ost.noarch.rpm       openstack-neutron-nuage-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-brocade-2015.1.4-11.el7ost.noarch.rpm         openstack-neutron-ofagent-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-cisco-2015.1.4-11.el7ost.noarch.rpm           openstack-neutron-oneconvergence-nvsd-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-common-2015.1.4-11.el7ost.noarch.rpm          openstack-neutron-opencontrail-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-embrane-2015.1.4-11.el7ost.noarch.rpm         openstack-neutron-openvswitch-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-ibm-2015.1.4-11.el7ost.noarch.rpm             openstack-neutron-ovsvapp-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-linuxbridge-2015.1.4-11.el7ost.noarch.rpm     openstack-neutron-plumgrid-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-mellanox-2015.1.4-11.el7ost.noarch.rpm        openstack-neutron-sriov-nic-agent-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-metaplugin-2015.1.4-11.el7ost.noarch.rpm      openstack-neutron-vmware-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-metering-agent-2015.1.4-11.el7ost.noarch.rpm  python-neutron-2015.1.4-11.el7ost.noarch.rpm
  openstack-neutron-midonet-2015.1.4-11.el7ost.noarch.rpm         python-neutron-tests-2015.1.4-11.el7ost.noarch.rpm
  
2. And using '-Fvh' for upgrading, so I think they saw mockbuild error with it.
   I confirmed as follows that '-Fvh' also install src.rpm, though it's not existing on the box before running.
  
  [root@el72-osp7-all-virbr-br0 HOTFIX_CASE-01735001_BZ-1393175]# rpm -Fvh *rpm
  Preparing...                          ################################# [100%]
  Updating / installing...
     1:python-neutron-2015.1.4-11.el7ost################################# [ 10%]
     2:openstack-neutron-common-2015.1.4################################# [ 20%]  <=========== noarch.rpm
     3:openstack-neutron-2015.1.4-11.el7warning: /etc/neutron/l3_agent.ini created as /etc/neutron/l3_agent.ini.rpmnew
  ################################# [ 30%]
     4:openstack-neutron-ml2-2015.1.4-11################################# [ 40%]
     5:openstack-neutron-openvswitch-201################################# [ 50%]
  Cleaning up / removing...
     6:openstack-neutron-openvswitch-201################################# [ 60%]
     7:openstack-neutron-ml2-2015.1.4-2.################################# [ 70%]
     8:openstack-neutron-2015.1.4-2.el7o################################# [ 80%]
     9:openstack-neutron-common-2015.1.4################################# [ 90%]
    10:python-neutron-2015.1.4-2.el7ost ################################# [100%]
  Updating / installing...
     1:openstack-neutron-2015.1.4-11.el7################################# [100%]  <========== src.rpm
  warning: user mockbuild does not exist - using root
  warning: group mockbuild does not exist - using root
  warning: user mockbuild does not exist - using root
  ..
  ~~~

3. This is different from customer's expectation which clearly says we won't install packages which is not previously installed on the system.   
  
  RPM(8)
  ~~~
  rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
          This will upgrade packages, but only ones for which an earlier version is installed.
  ~~~
  
  
Actual results:

  SRPM is installed with '-F' option  
  
Expected results:

  We should change documentation or SRPM should not be installed with '-F' option. 
  Looks SRPM is not considered as target package with '-F', and it should be by-design and need to fix doc / manpage.
  
Additional info:


  We comparing version with INSTALL_FRESHEN.

  rpm-4.13.0/lib/rpminstall.c
    
  367 /* On --freshen, verify package is installed and newer */
  368 static int checkFreshenStatus(rpmts ts, Header h)
  369 {
  370     rpmdbMatchIterator mi = NULL;
  371     const char * name = headerGetString(h, RPMTAG_NAME);
  372     const char *arch = headerGetString(h, RPMTAG_ARCH);
  373     Header oldH = NULL;
  374 
  375     if (name != NULL)
  376         mi = rpmtsInitIterator(ts, RPMDBI_NAME, name, 0);
  377     if (rpmtsColor(ts) && arch)                                      <====== 
  378         rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_DEFAULT, arch);  <====== Iterator is set here, but "src" arch is not defined,
                                                                                   so we cannot handle correctly even if stop "continue"ing at #553
  379 
  380     while ((oldH = rpmdbNextIterator(mi)) != NULL) {
  381         /* Package is newer than those currently installed. */
  382         if (rpmVersionCompare(oldH, h) < 0)
  383             break;
  384     }
  385 
  386     rpmdbFreeIterator(mi);
  387     return (oldH != NULL);
  388 }
  
  <...>
  
  403 /** @todo Generalize --freshen policies. */
  404 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
  405 {
  
  <...>
  
  544         if (headerIsSource(h)) {
  545             rpmlog(RPMLOG_DEBUG, "\tadded source package [%d]\n",
  546                 eiu->numSRPMS);
  547             eiu->sourceURL = xrealloc(eiu->sourceURL,
  548                                 (eiu->numSRPMS + 2) * sizeof(*eiu->sourceURL));
  549             eiu->sourceURL[eiu->numSRPMS] = *eiu->fnp;
  550             *eiu->fnp = NULL;
  551             eiu->numSRPMS++;
  552             eiu->sourceURL[eiu->numSRPMS] = NULL;
  553             continue;                                     <============ we're "continue"ing here.
  554         }
  555 
  556         if (eiu->relocations) {
  557             struct rpmtd_s prefixes;
  558 
  559             headerGet(h, RPMTAG_PREFIXES, &prefixes, HEADERGET_DEFAULT);
  560             if (rpmtdCount(&prefixes) == 1) {
  561                 eiu->relocations->oldPath = xstrdup(rpmtdGetString(&prefixes));
  562                 rpmtdFreeData(&prefixes); 
  563             } else {
  564                 rpmlog(RPMLOG_ERR, _("package %s is not relocatable\n"),
  565                        headerGetString(h, RPMTAG_NAME));
  566                 eiu->numFailed++;
  567                 goto exit;
  568             }
  569         }
  570 
  571         if (ia->installInterfaceFlags & INSTALL_FRESHEN) <============ INSTALL_FRESHEN bit is checked here.
  572             if (checkFreshenStatus(ts, h) != 1) {
  573                 headerFree(h);
  574                 continue;
  575             }

Comment 1 Panu Matilainen 2016-12-08 13:55:56 UTC
An installed SRPM is an oxymoron to begin with, they're never installed in the rpm sense, only unpacked.

First time I've ever heard anybody throw src.rpm's into -F, but yeah optimally -F should probably not unpack src.rpms.

Comment 2 Masaki Furuta ( RH ) 2016-12-08 14:55:43 UTC
(In reply to Panu Matilainen from comment #1)

I agree.
Should we note that in the manpage (like "This only works with binary RPMs, not with source RPM") or just leave it as is ?

If it's too trivial, please close bz.

Comment 4 Florian Festi 2017-07-12 14:42:10 UTC
Fixed upstream as 10c1d10d6389a8389cfaf003365fb70ef4b4e00b.

It is still not important enough to fix in the current release IMHO. Closing.