Bug 469197 - netfs dispatcher script wrongly returns exit status 1
netfs dispatcher script wrongly returns exit status 1
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-30 11:20 EDT by Orion Poplawski
Modified: 2014-03-16 23:16 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-11-03 16:38:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Orion Poplawski 2008-10-30 11:20:26 EDT
Description of problem:

Oct 29 11:35:35 test nm-dispatcher.action: Script '/etc/NetworkManager/dispatcher.d/05-netfs' exited with error status 1.


05-netfs does:

if [ "$2" = "down" ]; then
        /sbin/ip route ls | grep -q ^default || {
                [ -f /var/lock/subsys/netfs ] && /etc/rc.d/init.d/netfs stop
        }
fi

if [ "$2" = "up" ]; then
        /sbin/ip -o route show dev "$1" | grep -q '^default' && {
                /sbin/chkconfig netfs && /etc/rc.d/init.d/netfs start
        }
fi


which will return exit status 1 on up and down if netfs is not enabled (probably not what we want).  

Not really sure how to fix this properly and only return the exit code of init.d/netfs if we run it.

Version-Release number of selected component (if applicable):
NetworkManager-0.7.0-0.11.svn4022.4.fc9.i386
Comment 1 Orion Poplawski 2008-10-30 11:23:03 EDT
It will also return 1 if NM brings up a new interface that is not the default route.
Comment 2 Dan Williams 2008-10-30 12:59:21 EDT
05-netfs is provided by initscripts

Bill: dispatcher scripts don't get an indication of whether the device is the default device or not, but that's certainly something that I can add if needed.
Comment 3 Bill Nottingham 2008-10-30 14:05:22 EDT
Realistically... do we care about the return code of the script?
Comment 4 Bill Nottingham 2008-10-30 14:10:07 EDT
diff --git a/NetworkManager/dispatcher.d/05-netfs b/NetworkManager/dispatcher.d/05-netfs
index 46d4bb4..655c87a 100755
--- a/NetworkManager/dispatcher.d/05-netfs
+++ b/NetworkManager/dispatcher.d/05-netfs
@@ -4,13 +4,13 @@ export LC_ALL=C
 
 if [ "$2" = "down" ]; then
 	/sbin/ip route ls | grep -q ^default || {
-		[ -f /var/lock/subsys/netfs ] && /etc/rc.d/init.d/netfs stop
-	}
+		[ -f /var/lock/subsys/netfs ] && /etc/rc.d/init.d/netfs stop || :
+	} && { :; }
 fi
 
 if [ "$2" = "up" ]; then
 	/sbin/ip -o route show dev "$1" | grep -q '^default' && {
-		/sbin/chkconfig netfs && /etc/rc.d/init.d/netfs start
-	}
+		/sbin/chkconfig netfs && /etc/rc.d/init.d/netfs start || :
+	} || { :; }
 fi

This would solve it. Also would increase the line noise content of the script, which may or may not be a good thing.
Comment 5 Bill Nottingham 2008-10-30 14:11:49 EDT
That being said, slapping a 'exit 0' at the bottom is far simpler.
Comment 6 Bill Nottingham 2008-11-03 16:38:53 EST
Fixed in 8.85-1.

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