Bug 521807 - Wrong return code in wpa_supplicant init script
Wrong return code in wpa_supplicant init script
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: wpa_supplicant (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Dan Williams
Fedora Extras Quality Assurance
:
Depends On:
Blocks: InitScriptsProject
  Show dependency treegraph
 
Reported: 2009-09-08 08:11 EDT by Tomas Pelka
Modified: 2010-01-19 15:49 EST (History)
1 user (show)

See Also:
Fixed In Version: 0.6.8-6.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-12-22 14:57:28 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)
adding "-P /var/run/wpa_supplicant.pid" to wpa_supplicant arguments (1.23 KB, patch)
2009-11-12 10:16 EST, Jirka Klimes
no flags Details | Diff

  None (edit)
Description Tomas Pelka 2009-09-08 08:11:57 EDT
Description of problem:
According to https://fedoraproject.org/wiki/FCNewInit/Initscripts wpa_supplicant
init scipt start should return 0 when wpa%suplicant is already running. 


Version-Release number of selected component (if applicable):
wpa_supplicant-0.6.8-6.fc12.x86_64

How reproducible:
always

Steps to Reproduce:
1. service NetworkManager stop && service wpa_supplicant stop
2. service wpa_supplicant start
3. service wpa_supplicant start; echo $?
  
Actual results:
ret code 1

Expected results:
ret code 0

Additional info:
Comment 1 Jirka Klimes 2009-11-12 10:16:29 EST
Created attachment 369229 [details]
adding "-P /var/run/wpa_supplicant.pid" to wpa_supplicant arguments

The code "1" is returned because daemon() function of init scripts
just checks running instance by means of a pid file presence. As it doesn't exist the function continues and fails later.

So the patch adds the pid parameter to
wpa_supplicant.sysconfig, that is used by initscripts.

The parameter is also added to 
wpa_supplicant-0.5.10-dbus-service-file.patch in order NetworkManager invoked wpa_supplicant used it as well.

The problem still remains in this scenario:
1. service NetworkManager start
2. service wpa_supplicant stop
3. service wpa_supplicant start

The step 3) returns "1", because there is a race in step 2).
Step 2) stops wpa_supplicant, but it is immediately restarted by NetworkManager. However init script continues and removes the pid file of the new wpa_supplicant instance.
That's why wpa_supplicant is running before step 3), but the pid file doesn't exist.
Comment 2 Bug Zapper 2009-11-16 07:03:17 EST
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Dan Williams 2009-11-29 17:34:48 EST
Shouldn't the initscripts check if the pid in the pidfile they are about to remove is actually in-use by the correct program?  If it's about to remove the file but the pid in that file refers to a running instance of the program, it probably shouldn't remove the pidfile.

In any case, doing a new build with the patch, thanks Jirka!
Comment 4 Fedora Update System 2009-11-29 17:41:31 EST
wpa_supplicant-0.6.8-6.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/wpa_supplicant-0.6.8-6.fc11
Comment 5 Fedora Update System 2009-11-29 18:52:06 EST
wpa_supplicant-0.6.8-7.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/wpa_supplicant-0.6.8-7.fc12
Comment 6 Fedora Update System 2009-11-30 23:20:26 EST
wpa_supplicant-0.6.8-6.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update wpa_supplicant'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-12346
Comment 7 Fedora Update System 2009-12-22 14:56:21 EST
wpa_supplicant-0.6.8-7.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2009-12-22 14:57:19 EST
wpa_supplicant-0.6.8-6.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

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