Bug 285920

Summary: Yast2 Runlevel editor returns wrong exit code of services
Product: [openSUSE] openSUSE 10.3 Reporter: Ladislav Michnovic <lmichnovic>
Component: YaST2Assignee: Lukas Ocilka <locilka>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: aj, lslezak
Version: Alpha 5   
Target Milestone: ---   
Hardware: i386   
OS: openSUSE 10.3   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2logs
screenshot 1
screenshot 2
screenshot 3
Please, try this patched file
New background agent
Proposed patch

Description Ladislav Michnovic 2007-06-20 14:28:27 UTC
Created attachment 147378 [details]
y2logs

I was checking the state of boot.quota service in runlevel editor in export mode. At first time it returned wrong exit code. Checked again, it returned correct exit code. After changing status af the service (stop or start) it showed again wrong exit code for the first check. Checking the exit code in terminal it always returned correct. Attaching some screenshots and y2logs.
Comment 1 Ladislav Michnovic 2007-06-20 14:30:56 UTC
Created attachment 147379 [details]
screenshot 1
Comment 2 Ladislav Michnovic 2007-06-20 14:31:17 UTC
Created attachment 147380 [details]
screenshot 2
Comment 3 Ladislav Michnovic 2007-06-20 14:31:39 UTC
Created attachment 147381 [details]
screenshot 3
Comment 4 Lukas Ocilka 2007-06-21 15:43:06 UTC
miracle:~ # /etc/init.d/boot.quota status; echo $?
Checking for quota:    unused
3
miracle:~ # /etc/init.d/boot.quota start; echo $?
Turning quota on
Checking quotas. This may take some time.
                       done
0
miracle:~ # /etc/init.d/boot.quota status; echo $?
Checking for quota:    unused
3
miracle:~ # /etc/init.d/boot.quota stop; echo $?
Turning off quota
                       done
0

--- --- ---

Initially not running (exit 3)
Started (exit 0) -- probably wrong exit code
After start, not running (exit 3)
Stopped (exit 0)
Comment 5 Ladislav Michnovic 2007-06-25 09:09:11 UTC
miracle:~ # /etc/init.d/boot.quota start; echo $?
Turning quota on
Checking quotas. This may take some time.
                       done
0
miracle:~ # /etc/init.d/boot.quota status; echo $?
Checking for quota:    unused
3

This behavior is intended. Becasue you probably do not have any partition mounted with quota support, so boot.quota is still unused after start. 

But this bug is about that the exit codes shown in yast module differs from exit codes shown in terminal. 
Comment 6 Ladislav Michnovic 2007-07-09 14:00:19 UTC
This bug is about yast2 shows different exit codes than terminal. 
If you want to discus sanity of exit codes in quota, please fill a new bug.
Comment 7 Lukas Ocilka 2007-07-09 14:47:22 UTC
For status checking, Status::RunInitScriptWithTimeOut("boot.quota", "status") was used

Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Time spent: 20 msecs, retcode: 0

Then Status::RunInitScriptWithTimeOut("boot.quota", ...) was used several times with different result:

Service.ycp:297 Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 40 msecs, retcode: 4

Service.ycp:297 Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 40 msecs, retcode: 0

Service.ycp:297 Running service initscript boot.quota start 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 20 msecs, retcode: 0

Service.ycp:297 Running service initscript boot.quota stop 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 240 msecs, retcode: 0

Service.ycp:297 Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 160 msecs, retcode: 0

Service.ycp:297 Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 140 msecs, retcode: 3

Service.ycp:297 Running service initscript boot.quota status 2>&1 1>/tmp/YaST2-03827-Gjtl2k/runlevel_out
Service.ycp:332 Time spent: 80 msecs, retcode: 3

Agent .target.background is used for that
Lslezak: could you, please, check Service::RunInitScriptWithTimeOut()?
Thanks.
Comment 8 Lukas Ocilka 2007-07-10 15:42:03 UTC
Created attachment 150524 [details]
Please, try this patched file

(Copy the file to /usr/share/YaST2/include/runlevel/ directory and run `yast2 runlevel`)

Thanks
Comment 9 Ladislav Michnovic 2007-07-11 12:01:48 UTC
It is still returning previous exit code when checking more times.
Comment 10 Lukas Ocilka 2007-07-12 09:34:53 UTC
Created attachment 150872 [details]
New background agent

Please, save this attachment to /usr/lib/YaST2/servers_non_y2/ag_background
and recheck... thanks
Comment 11 Ladislav Michnovic 2007-07-12 09:46:16 UTC
It works now. 
Comment 12 Lukas Ocilka 2007-07-12 09:51:32 UTC
Created attachment 150873 [details]
Proposed patch
Comment 13 Lukas Ocilka 2007-07-12 10:00:10 UTC
Fixed in yast2-core-2.15-7
Comment 14 Stanislav Visnovsky 2007-08-13 11:00:30 UTC
*** Bug 261239 has been marked as a duplicate of this bug. ***