Bug 469197 - netfs dispatcher script wrongly returns exit status 1
Summary: netfs dispatcher script wrongly returns exit status 1
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-10-30 15:20 UTC by Orion Poplawski
Modified: 2014-03-17 03:16 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-11-03 21:38:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Orion Poplawski 2008-10-30 15:20:26 UTC
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 15:23:03 UTC
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 16:59:21 UTC
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 18:05:22 UTC
Realistically... do we care about the return code of the script?

Comment 4 Bill Nottingham 2008-10-30 18:10:07 UTC
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 18:11:49 UTC
That being said, slapping a 'exit 0' at the bottom is far simpler.

Comment 6 Bill Nottingham 2008-11-03 21:38:53 UTC
Fixed in 8.85-1.


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