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
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.
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
*** Bug 2221104 has been marked as a duplicate of this bug. ***
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