Bug 1087950

Summary: nfs-utils should not enable itself
Product: [Fedora] Fedora Reporter: Andy Lutomirski <luto>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: bfields, luto, marcosfrm, steved
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-1.3.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 11:22:45 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: 1090684    

Description Andy Lutomirski 2014-04-15 16:55:38 UTC
nfs-utils.spec contains:

if [ $1 -eq 1 ]; then
	/bin/systemctl enable nfs-client.target >/dev/null 2>&1 || :
	/bin/systemctl restart nfs-config >/dev/null 2>&1 || :
[...]

This is bad: nfs-utils is required by things like libvirt, but nfs-utils should not listen by default, especially when it's not even exporting anything.

Comment 1 Lennart Poettering 2014-04-15 21:07:40 UTC
Please move to the preset-enabled rpm macros:

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Macroized_scriptlets_.28Fedora_18.2B.29

Comment 2 Steve Dickson 2014-04-15 23:50:35 UTC
Something like this:

diff --git a/nfs-utils.spec b/nfs-utils.spec
index 64e413c..a2e37d8 100644
--- a/nfs-utils.spec
+++ b/nfs-utils.spec
@@ -190,17 +190,10 @@ else
 fi
 
 %post
-if [ $1 -eq 1 ]; then
-       /bin/systemctl enable nfs-client.target >/dev/null 2>&1 || :
-       /bin/systemctl restart nfs-config >/dev/null 2>&1 || :
-else
-       # Package upgrade
-       /bin/systemctl reenable nfs-client.target >/dev/null 2>&1 || :
-       /bin/systemctl restart nfs-config >/dev/null 2>&1 || :
-       if /bin/systemctl --quiet is-enabled nfs-server ; then
-               /bin/systemctl reenable nfs-server >/dev/null 2>&1 || :
-       fi
-fi
+%systemd_post nfs-client.target
+%systemd_post nfs-config
+%systemd_post nfs-server
+
 # Make sure statd used the correct uid/gid.
 chown -R rpcuser:rpcuser /var/lib/nfs/statd
 
@@ -218,7 +211,7 @@ if [ $1 -eq 0 ]; then
 fi
 
 %postun
-       %systemd_postun_with_restart  nfs-server
+%systemd_postun_with_restart  nfs-server
 if [ $1 -ge 1 ]; then
        /bin/systemctl try-restart nfs-client.target >/dev/null 2>&1 || :
        /bin/systemctl try-restart nfs-server.target >/dev/null 2>&1 || :

Comment 3 Steve Dickson 2014-05-24 15:31:43 UTC
Fixed in: nfs-utils-1.3.0-1.3.fc21

Comment 4 Jaroslav Reznik 2015-03-03 17:12:47 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 5 Fedora End Of Life 2016-07-19 11:22:45 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.