Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 521807 - Wrong return code in wpa_supplicant init script
Summary: Wrong return code in wpa_supplicant init script
Alias: None
Product: Fedora
Classification: Fedora
Component: wpa_supplicant
Version: 12
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Dan Williams
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: InitScriptsProject
TreeView+ depends on / blocked
Reported: 2009-09-08 12:11 UTC by Tomas Pelka
Modified: 2010-01-19 20:49 UTC (History)
1 user (show)

Fixed In Version: 0.6.8-6.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-12-22 19:57:28 UTC
Type: ---

Attachments (Terms of Use)
adding "-P /var/run/wpa_supplicant.pid" to wpa_supplicant arguments (1.23 KB, patch)
2009-11-12 15:16 UTC, Jirka Klimes
no flags Details | Diff

Description Tomas Pelka 2009-09-08 12:11:57 UTC
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):

How reproducible:

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 15:16:29 UTC
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 12:03:17 UTC
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:

Comment 3 Dan Williams 2009-11-29 22:34:48 UTC
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 22:41:31 UTC
wpa_supplicant-0.6.8-6.fc11 has been submitted as an update for Fedora 11.

Comment 5 Fedora Update System 2009-11-29 23:52:06 UTC
wpa_supplicant-0.6.8-7.fc12 has been submitted as an update for Fedora 12.

Comment 6 Fedora Update System 2009-12-01 04:20:26 UTC
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 19:56:21 UTC
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 19:57:19 UTC
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.