Bug 1856881

Summary: /etc/group file is modified/touched after the update for nfs-utils
Product: Red Hat Enterprise Linux 8 Reporter: Parikshit Khedekar <pkhedeka>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.0CC: dwysocha, steved, xzhou
Target Milestone: rcKeywords: Patch, Reproducer, Triaged
Target Release: 8.4   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-2.3.3-38.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1856884 (view as bug list) Environment:
Last Closed: 2021-05-18 15:04:48 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: 1856884    

Description Parikshit Khedekar 2020-07-14 15:51:10 UTC
Description of problem:

Updating the nfs-utils modifies the /etc/group file. This is not expected if the package is already installed and the 'rpcuser' group is already there.

The if statement for the nfsnobody seems to be fine but the code for rpcuser needs enhancements as,


The problem is with the prescript of the rpm as,

Current spec file:
~~~~~~~~~

# Create rpcuser gid as long as it does not already exist
cat /etc/group | cut -d':' -f 1 | grep --quiet rpcuser 2>/dev/null
if [ "$?" -eq 1 ]; then
    /usr/sbin/groupadd -g 29 rpcuser >/dev/null 2>&1 || :
else
    /usr/sbin/groupmod -g 29 rpcuser >/dev/null 2>&1 || :
fi

~~~~~~~~~

Here even the conditions falses the same command is marked to get executed.

The changes to the spec file should be as for modifying/changing the pre-scripts as,

~~~~~~~~~

# Create rpcuser gid as long as it does not already exist
cat /etc/group | cut -d':' -f 1 | grep --quiet rpcuser 2>/dev/null
if [ "$?" -eq 1 ]; then
    /usr/sbin/groupadd -g 29 rpcuser >/dev/null 2>&1 || :

fi

~~~~~~~~~


Version-Release number of selected component (if applicable):
RHEL 8/RHEL7

Any release of nfs-utils


How reproducible:

#stat /etc/group -->> check file stamp before update of package.

#yum update nfs-utils

#stat /etc/group -->> check file stamp after update of package. 

Steps to Reproduce:
1. check time stamp of the /etc/group file
2. Update the nfs-utils package
3. Check time stamp of the /etc/group file which differs
 
Actual results:

It does modifies the file unnecessorily.


Expected results:

It should not run the command again if the 


Additional info:

Comment 16 Yongcheng Yang 2020-12-14 02:16:41 UTC
Moving to VERIFIED now:

[14:23:03 root@ ~~]# id rpcuser
uid=29(rpcuser) gid=29(rpcuser) groups=29(rpcuser)
[14:23:03 root@ ~~]# stat -c %z /etc/group
2020-12-12 14:22:46.945391977 +0200    <<<<<<<<<<<
[14:23:03 root@ ~~]# yum -y update nfs-utils
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
beaker-AppStream                                1.4 MB/s | 6.4 MB     00:04    
beaker-BaseOS                                   760 kB/s | 2.4 MB     00:03    
beaker-CRB                                      634 kB/s | 2.0 MB     00:03    
Dependencies resolved.
================================================================================
 Package             Arch        Version               Repository          Size
================================================================================
Upgrading:
 nfs-utils           x86_64      1:2.3.3-39.el8        beaker-BaseOS      496 k
Installing dependencies:
 python3-pyyaml      x86_64      3.12-12.el8           beaker-BaseOS      193 k

Transaction Summary
================================================================================
Install  1 Package
Upgrade  1 Package

Total download size: 689 k
Downloading Packages:
(1/2): python3-pyyaml-3.12-12.el8.x86_64.rpm    131 kB/s | 193 kB     00:01    
(2/2): nfs-utils-2.3.3-39.el8.x86_64.rpm        257 kB/s | 496 kB     00:01    
--------------------------------------------------------------------------------
Total                                           357 kB/s | 689 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Running scriptlet: python3-pyyaml-3.12-12.el8.x86_64                      1/1 
  Installing       : python3-pyyaml-3.12-12.el8.x86_64                      1/3 
  Running scriptlet: nfs-utils-1:2.3.3-39.el8.x86_64                        2/3 
  Upgrading        : nfs-utils-1:2.3.3-39.el8.x86_64                        2/3 
  Running scriptlet: nfs-utils-1:2.3.3-39.el8.x86_64                        2/3 
  Running scriptlet: nfs-utils-1:2.3.3-31.el8.x86_64                        3/3 
  Cleanup          : nfs-utils-1:2.3.3-31.el8.x86_64                        3/3 
  Running scriptlet: nfs-utils-1:2.3.3-31.el8.x86_64                        3/3 
  Verifying        : python3-pyyaml-3.12-12.el8.x86_64                      1/3 
  Verifying        : nfs-utils-1:2.3.3-39.el8.x86_64                        2/3 
  Verifying        : nfs-utils-1:2.3.3-31.el8.x86_64                        3/3 
Installed products updated.

Upgraded:
  nfs-utils-1:2.3.3-39.el8.x86_64                                               

Installed:
  python3-pyyaml-3.12-12.el8.x86_64                                             

Complete!
[14:36:37 root@ ~~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 Beta (Ootpa)
[14:36:37 root@ ~~]# test 1607775766 -eq 1607775766
[14:36:37 root@ ~~]# stat -c %z /etc/group
2020-12-12 14:22:46.945391977 +0200              <<<<<<<<<<<<<

Comment 18 errata-xmlrpc 2021-05-18 15:04:48 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 (nfs-utils 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:1669