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 1927245 - The subscription-manager RPM package does not mark some directories as part of the RPM package
Summary: The subscription-manager RPM package does not mark some directories as part o...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Jiri Hnidek
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-10 11:58 UTC by Jiri Hnidek
Modified: 2021-11-10 07:52 UTC (History)
5 users (show)

Fixed In Version: subscription-manager-1.28.15-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:37:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2446 0 None open 1927245: Mark several dir as part of RPM; ENT-3555 2021-02-16 15:36:45 UTC
Github candlepin subscription-manager pull 2449 0 None open 1927245: (1.28 backport) Mark several dir as part of RPM; ENT-3555 2021-02-18 16:02:19 UTC
Red Hat Product Errata RHBA-2021:4390 0 None None None 2021-11-09 19:37:50 UTC

Description Jiri Hnidek 2021-02-10 11:58:05 UTC
Description of problem:
RPM package subscription-manager does not mark some directories as part of the RPM. It can causes several issues. When RPM is removed from the system, then filesystem is not cleaned from directories that are not needed anymore.

One directory is bigger issue that ther others. This directory:

/usr/lib64/python3.6/site-packages/subscription_manager-1.28.10-py3.6.egg-info

would cause big issues in the future. When there is more than one subscription-manager-<version>.egg-info directory, than subscription-manager entry point Python script generated by python3-setuptools will not be able to start subscription-manager (tested on Fedora). Thus it would not be possible to start subscription-manager on some future version of RHEL.


Version-Release number of selected component (if applicable):
[root@ip-172-31-42-54 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.11-1
subscription management rules: 5.41
subscription-manager: 1.28.10-1.el8

How reproducible:
100%

Steps to Reproduce:
1. Check that subscription-manager is installed in the system:

[root@localhost ~]# rpm -q subscription-manager
subscription-manager-1.28.10-1.el8.x86_64

2. Run following Python script. This script print directories, that are not part of RPM,
   but are used by some files.

```python
#!/usr/bin/env python3

"""
Script for checking RPMs directory structure. Prints directories that are not part of RPM,
but are used by RPM.

The output of this script can only help you to find directories that should be part of
the RPM. Many directories should not be part of RPM, like /usr/bin or /usr/share/man/man8.

So it is necessary to have some experience with checked RPM package and UNIX directory
structure.
"""

import subprocess
import sys
import os


def check_rpm_structure(rpm):
    """
    Check rpm structure
    """

    # Run process
    completed_process = subprocess.run(
        ["rpm", "-ql", rpm],
        stdout=subprocess.PIPE,
        encoding='UTF-8'
    )

    # Try to parse output of process
    if completed_process.returncode == 0:

        dirs = []
        missing_dirs = []
        paths = completed_process.stdout.split()

        # Get list of all directories marked as part of RPM
        for path in paths:
            if os.path.isdir(path):
                dirs.append(path)

        # Go through the list of all files (not directories) and
        # check if directory name of file is marked as part of RPM
        for path in paths:
            if not os.path.isdir(path):
                dir_name = os.path.dirname(path)
                if dir_name not in dirs:
                    if dir_name not in missing_dirs:
                        missing_dirs.append(dir_name)

        # Print output in readable format
        print('\n'.join(missing_dirs))


def main():
    if len(sys.argv) != 2:
        print("Syntax: {cmd} rpm_installed_on_the_system".format(cmd=sys.argv[0]))
    else:
        check_rpm_structure(sys.argv[1])


if __name__ == '__main__':
    main()
```

Actual results:
[root@ip-172-31-42-54 ~]# ./check_rpm.py subscription-manager
/etc/dbus-1/system.d
/etc/dnf/plugins
/etc/logrotate.d
/etc/pam.d
/etc/security/console.apps
/etc/yum.repos.d
/usr/bin
/usr/lib/systemd/system
/usr/lib/tmpfiles.d
/usr/lib64/python3.6/site-packages/rhsmlib/candlepin
/usr/lib64/python3.6/site-packages/rhsmlib/cloud
/usr/lib64/python3.6/site-packages/rhsmlib/cloud/providers
/usr/lib64/python3.6/site-packages/rhsmlib/compat
/usr/lib64/python3.6/site-packages/rhsmlib/dbus
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/facts
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/objects
/usr/lib64/python3.6/site-packages/rhsmlib/facts
/usr/lib64/python3.6/site-packages/rhsmlib/services
/usr/lib64/python3.6/site-packages/subscription_manager-1.28.10-py3.6.egg-info
/usr/lib64/python3.6/site-packages/subscription_manager/api
/usr/lib64/python3.6/site-packages/subscription_manager/branding
/usr/lib64/python3.6/site-packages/subscription_manager/model
/usr/lib64/python3.6/site-packages/subscription_manager/plugin
/usr/lib64/python3.6/site-packages/subscription_manager/scripts
/usr/libexec
/usr/sbin
/usr/share/bash-completion/completions
/usr/share/dbus-1/system-services
/usr/share/locale/as/LC_MESSAGES
/usr/share/locale/bn_IN/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/gu/LC_MESSAGES
/usr/share/locale/hi/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/ja/LC_MESSAGES
/usr/share/locale/kn/LC_MESSAGES
/usr/share/locale/ko/LC_MESSAGES
/usr/share/locale/ml/LC_MESSAGES
/usr/share/locale/mr/LC_MESSAGES
/usr/share/locale/or/LC_MESSAGES
/usr/share/locale/pa/LC_MESSAGES
/usr/share/locale/pt_BR/LC_MESSAGES
/usr/share/locale/ru/LC_MESSAGES
/usr/share/locale/ta_IN/LC_MESSAGES
/usr/share/locale/te/LC_MESSAGES
/usr/share/locale/zh_CN/LC_MESSAGES
/usr/share/locale/zh_TW/LC_MESSAGES
/usr/share/man/man5
/usr/share/man/man8
/usr/share/polkit-1/actions

Expected results:

Following directories should be part of RPM and should not be listed in previous output:

/usr/lib64/python3.6/site-packages/rhsmlib/candlepin
/usr/lib64/python3.6/site-packages/rhsmlib/cloud
/usr/lib64/python3.6/site-packages/rhsmlib/cloud/providers
/usr/lib64/python3.6/site-packages/rhsmlib/compat
/usr/lib64/python3.6/site-packages/rhsmlib/dbus
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/facts
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/objects
/usr/lib64/python3.6/site-packages/rhsmlib/facts
/usr/lib64/python3.6/site-packages/rhsmlib/services
/usr/lib64/python3.6/site-packages/subscription_manager-1.28.10-py3.6.egg-info
/usr/lib64/python3.6/site-packages/subscription_manager/api
/usr/lib64/python3.6/site-packages/subscription_manager/branding
/usr/lib64/python3.6/site-packages/subscription_manager/model
/usr/lib64/python3.6/site-packages/subscription_manager/plugin
/usr/lib64/python3.6/site-packages/subscription_manager/scripts


Additional info:

Note: I observed multiple versions of .egg-info directories on one RHEL8 system:

[root@localhost ~]# ls -ld /usr/lib64/python3.6/site-packages/subscription_manager*.egg-info
drwxr-xr-x. 2 root root   6 Jan 26 12:49 /usr/lib64/python3.6/site-packages/subscription_manager-1.27.16-py3.6.egg-info
drwxr-xr-x. 2 root root 134 Jan 29 09:33 /usr/lib64/python3.6/site-packages/subscription_manager-1.28.10-py3.6.egg-info
drwxr-xr-x. 2 root root   6 Jan 29 09:33 /usr/lib64/python3.6/site-packages/subscription_manager-1.29.5-py3.6.egg-info

Comment 1 Jiri Hnidek 2021-02-10 12:03:09 UTC
This is output of RPM created from attached PR:

/etc/dbus-1/system.d
/etc/dnf/plugins
/etc/logrotate.d
/etc/pam.d
/etc/security/console.apps
/etc/yum.repos.d
/usr/bin
/usr/lib/python3.9/site-packages/dnf-plugins
/usr/lib/systemd/system
/usr/lib/tmpfiles.d
/usr/libexec
/usr/sbin
/usr/share/bash-completion/completions
/usr/share/dbus-1/system-services
/usr/share/locale/as/LC_MESSAGES
/usr/share/locale/bn_IN/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/gu/LC_MESSAGES
/usr/share/locale/hi/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/ja/LC_MESSAGES
/usr/share/locale/kn/LC_MESSAGES
/usr/share/locale/ko/LC_MESSAGES
/usr/share/locale/ml/LC_MESSAGES
/usr/share/locale/mr/LC_MESSAGES
/usr/share/locale/or/LC_MESSAGES
/usr/share/locale/pa/LC_MESSAGES
/usr/share/locale/pt_BR/LC_MESSAGES
/usr/share/locale/ru/LC_MESSAGES
/usr/share/locale/ta_IN/LC_MESSAGES
/usr/share/locale/te/LC_MESSAGES
/usr/share/locale/zh_CN/LC_MESSAGES
/usr/share/locale/zh_TW/LC_MESSAGES
/usr/share/man/man5
/usr/share/man/man8
/usr/share/polkit-1/actions

Comment 2 Rehana 2021-04-06 13:55:18 UTC
*** Bug 1945279 has been marked as a duplicate of this bug. ***

Comment 3 Archana Pandey 2021-04-14 11:49:56 UTC
Pre-verifying on build to be part of development compose : 

Re-producing issue on older version of sub-man

[root@hpe-dl380pgen8-02-vm-5 /]# rpm -qa subscription-manager
subscription-manager-1.28.13-2.el8.x86_64
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# ./check_rpm.py subscription-manager
/etc/dbus-1/system.d
/etc/dnf/plugins
/etc/logrotate.d
/etc/pam.d
/etc/security/console.apps
/etc/yum.repos.d
/usr/bin
/usr/lib/systemd/system
/usr/lib/tmpfiles.d
/usr/lib64/python3.6/site-packages/rhsmlib/candlepin
/usr/lib64/python3.6/site-packages/rhsmlib/cloud
/usr/lib64/python3.6/site-packages/rhsmlib/cloud/providers
/usr/lib64/python3.6/site-packages/rhsmlib/compat
/usr/lib64/python3.6/site-packages/rhsmlib/dbus
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/facts
/usr/lib64/python3.6/site-packages/rhsmlib/dbus/objects
/usr/lib64/python3.6/site-packages/rhsmlib/facts
/usr/lib64/python3.6/site-packages/rhsmlib/services
/usr/lib64/python3.6/site-packages/subscription_manager-1.28.13-py3.6.egg-info   <<<<< .egg-info, ../rhsmlib and ../subscription_manager Not marked as part of rpm
/usr/lib64/python3.6/site-packages/subscription_manager/api
/usr/lib64/python3.6/site-packages/subscription_manager/branding
/usr/lib64/python3.6/site-packages/subscription_manager/model
/usr/lib64/python3.6/site-packages/subscription_manager/plugin
/usr/lib64/python3.6/site-packages/subscription_manager/scripts
/usr/libexec
/usr/sbin
/usr/share/bash-completion/completions
/usr/share/dbus-1/system-services
/usr/share/locale/as/LC_MESSAGES
/usr/share/locale/bn_IN/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/gu/LC_MESSAGES
/usr/share/locale/hi/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/ja/LC_MESSAGES
/usr/share/locale/kn/LC_MESSAGES
/usr/share/locale/ko/LC_MESSAGES
/usr/share/locale/ml/LC_MESSAGES
/usr/share/locale/mr/LC_MESSAGES
/usr/share/locale/or/LC_MESSAGES
/usr/share/locale/pa/LC_MESSAGES
/usr/share/locale/pt_BR/LC_MESSAGES
/usr/share/locale/ru/LC_MESSAGES
/usr/share/locale/ta_IN/LC_MESSAGES
/usr/share/locale/te/LC_MESSAGES
/usr/share/locale/zh_CN/LC_MESSAGES
/usr/share/locale/zh_TW/LC_MESSAGES
/usr/share/man/man5
/usr/share/man/man8
/usr/share/polkit-1/actions
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# ll /usr/lib64/python3.6/site-packages/subscription_manager-1.28.13-py3.6.egg-info
total 32
-rw-r--r--. 1 root root     1 Mar 15 13:22 dependency_links.txt
-rw-r--r--. 1 root root   598 Mar 15 13:22 entry_points.txt
-rw-r--r--. 1 root root   455 Mar 15 13:22 PKG-INFO
-rw-r--r--. 1 root root    37 Mar 15 13:22 requires.txt
-rw-r--r--. 1 root root 11152 Mar 15 13:22 SOURCES.txt
-rw-r--r--. 1 root root    49 Mar 15 13:22 top_level.txt
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# yum remove subscription-manager -y -q

Removed:
  dnf-plugin-subscription-manager-1.28.13-2.el8.x86_64     python3-chardet-3.0.4-7.el8.noarch            python3-dmidecode-3.12.2-15.el8.x86_64       python3-ethtool-0.14-3.el8.x86_64                         
  python3-idna-2.5-5.el8.noarch                            python3-iniparse-0.4-31.el8.noarch            python3-inotify-0.9.6-13.el8.noarch          python3-librepo-1.12.0-3.el8.x86_64                       
  python3-libxml2-2.9.7-9.el8.x86_64                       python3-pysocks-1.6.8-3.el8.noarch            python3-requests-2.20.0-2.1.el8_1.noarch     python3-subscription-manager-rhsm-1.28.13-2.el8.x86_64    
  python3-urllib3-1.24.2-5.el8.noarch                      subscription-manager-1.28.13-2.el8.x86_64    

[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# ll /usr/lib64/python3.6/site-packages/subscription_manager-1.28.13-py3.6.egg-info
total 0

^^^^^ .egg-info not removed after package removal

===========================================================================================================

Verifying fix on latest build for sub-man: subscription-manager-1.28.15-1.el8.x86_64

Steps for verification-

[root@hpe-dl380pgen8-02-vm-5 ~]# 
[root@hpe-dl380pgen8-02-vm-5 ~]# rpm -qa subscription-manager
subscription-manager-1.28.15-1.el8.x86_64

[root@hpe-dl380pgen8-02-vm-5 ~]# rpm -q  --changelog subscription-manager | grep 1927245
- 1927245: Mark several dir as part of RPM (jhnidek)
- 1927245: Mark several dir as part of RPM (jhnidek)

[root@hpe-dl380pgen8-02-vm-5 ~]# 
[root@hpe-dl380pgen8-02-vm-5 ~]# cd /
[root@hpe-dl380pgen8-02-vm-5 /]# ./check_rpm.py subscription-manager
/etc/dbus-1/system.d
/etc/dnf/plugins
/etc/logrotate.d
/etc/pam.d
/etc/security/console.apps
/etc/yum.repos.d
/usr/bin
/usr/lib/systemd/system
/usr/lib/tmpfiles.d
/usr/libexec
/usr/sbin
/usr/share/bash-completion/completions
/usr/share/dbus-1/system-services
/usr/share/locale/as/LC_MESSAGES
/usr/share/locale/bn_IN/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/es/LC_MESSAGES
/usr/share/locale/fr/LC_MESSAGES
/usr/share/locale/gu/LC_MESSAGES
/usr/share/locale/hi/LC_MESSAGES
/usr/share/locale/it/LC_MESSAGES
/usr/share/locale/ja/LC_MESSAGES
/usr/share/locale/kn/LC_MESSAGES
/usr/share/locale/ko/LC_MESSAGES
/usr/share/locale/ml/LC_MESSAGES
/usr/share/locale/mr/LC_MESSAGES
/usr/share/locale/or/LC_MESSAGES
/usr/share/locale/pa/LC_MESSAGES
/usr/share/locale/pt_BR/LC_MESSAGES
/usr/share/locale/ru/LC_MESSAGES
/usr/share/locale/si/LC_MESSAGES
/usr/share/locale/ta_IN/LC_MESSAGES
/usr/share/locale/te/LC_MESSAGES
/usr/share/locale/zh_CN/LC_MESSAGES
/usr/share/locale/zh_TW/LC_MESSAGES
/usr/share/man/man5
/usr/share/man/man8
/usr/share/polkit-1/actions
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# ll /usr/lib64/python3.6/site-packages/subscription_manager-1.28.15-py3.6.egg-info
total 32
-rw-r--r--. 1 root root     1 Mar 31 10:57 dependency_links.txt
-rw-r--r--. 1 root root   598 Mar 31 10:57 entry_points.txt
-rw-r--r--. 1 root root   455 Mar 31 10:57 PKG-INFO
-rw-r--r--. 1 root root    37 Mar 31 10:57 requires.txt
-rw-r--r--. 1 root root 11161 Mar 31 10:57 SOURCES.txt
-rw-r--r--. 1 root root    49 Mar 31 10:57 top_level.txt
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# yum remove subscription-manager -y -q

[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# 
[root@hpe-dl380pgen8-02-vm-5 /]# ll /usr/lib64/python3.6/site-packages/subscription_manager-1.28.15-py3.6.egg-info
ls: cannot access '/usr/lib64/python3.6/site-packages/subscription_manager-1.28.15-py3.6.egg-info': No such file or directory                                           
^^^^^^^^^^^^directory removed successfully as part of rpm after package removal


Verified: All directories specific for subscription marked as part of the RPM and .egg-info packages removed after package removal

Comment 9 errata-xmlrpc 2021-11-09 19:37:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (subscription-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4390


Note You need to log in before you can comment on or make changes to this bug.