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 2218279

Summary: sos clean - Respect permissions of sanitised files
Product: Red Hat Enterprise Linux 8 Reporter: Jan Jansky <jjansky>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Daniel Záležák <dzalezak>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.8CC: agk, dzalezak, jcastillo, jjansky, mhradile, pgm-rhel-tools, plambri, sbradley, theute, toneata
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.5.5-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2221104 (view as bug list) Environment:
Last Closed: 2023-07-26 08:37:56 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: 2221104    

Description Jan Jansky 2023-06-28 14:30:19 UTC
Description of problem:
When copying files we applied a substitution in, we must replace just original file content (shutil.copyfile) and not also its stat data (shutil.copy).

Version-Release number of selected component (if applicable):
4.5.5

Comment 2 Pavel Moravec 2023-06-28 14:52:39 UTC
Trivial reproducer:

1) Ensure /etc/hosts has system's FQDN, e.g. add there:

echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts

2) Run:
# sos report --clean -o networking --batch --build
..
Your sosreport build tree has been generated in:
	/var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp

3) Compare permissions:
# ll /etc/hosts /var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp/etc/hosts
-rw-r--r--. 1 root root 1134 Jun 12 08:37 /etc/hosts
-rw-------. 1 root root  798 Jun 28 16:49 /var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp/etc/hosts
#

See the missing go+r flags.

Comment 3 Daniel Záležák 2023-07-05 18:46:29 UTC
Switched Tested based on positive results from manual test:

OLD
RHEL-8.9
x86_64
sos-4.5.1-3.el8.noarch

# echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts
# sos report --clean -o networking --batch --build
# ll /etc/hosts /var/tmp/sosreport-host0-2023-07-05-ihejuje/etc/host66
-rw-r--r--. 1 root root 304 Jul  5 14:35 /etc/hosts
-rw-------. 1 root root 202 Jul  5 14:29 /var/tmp/sosreport-host0-2023-07-05-ihejuje/etc/host66

``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

NEW
RHEL-8.9
x86_64
sos-4.5.5-1.el8.noarch

# echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts
# sos report --clean -o networking --batch --build
# ll /etc/hosts /var/tmp/sosreport-host0-2023-07-05-peqncnf/etc/host66
-rw-r--r--. 1 root root 377 Jul  5 14:37 /etc/hosts
-rw-r--r--. 1 root root 290 Jul  5 14:37 /var/tmp/sosreport-host0-2023-07-05-peqncnf/etc/host66

Comment 6 Jan Jansky 2023-07-19 07:09:26 UTC
*** Bug 2221104 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2023-07-26 08:37:56 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 (sos 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-2023:4279