Bug 524016 - Init script needs a few fixes for LBS compliance (and some cleanup, too)
Summary: Init script needs a few fixes for LBS compliance (and some cleanup, too)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mailman
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Novotny
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: InitScriptsProject
TreeView+ depends on / blocked
 
Reported: 2009-09-17 15:33 UTC by Radek Bíba
Modified: 2009-10-07 10:53 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-07 10:53:00 UTC


Attachments (Terms of Use)
a proposed patch to address those issues (1.02 KB, patch)
2009-09-21 12:50 UTC, Daniel Novotny
no flags Details | Diff
a new version of the patch (1.25 KB, patch)
2009-10-05 11:24 UTC, Daniel Novotny
no flags Details | Diff
3rd version of the patch (1.43 KB, patch)
2009-10-06 13:58 UTC, Daniel Novotny
no flags Details | Diff

Description Radek Bíba 2009-09-17 15:33:33 UTC
The mailman init script has the following issues:

* when mailman is unconfigured, `service mailman start' should exit with code 6, not 1.

* `try-restart' isn't implemented. This is an addition to condrestart and should have the same effect.

* stopping mailman doesn't remove its pid file. This is visible when attempting to stop an already stopped service:

# service mailman stop
Shutting down mailman: No child with pid: 14099
[Errno 3] No such process
Stale pid file removed.

So this is actually twofold: those two lines are quite scary, the init script shouldn't even attempt to stop the process if it isn't running, or it should handle this case more gracefully. And when stopping it, it should delete the pid file. (it already deletes the lock file)

* when /var/lock/subsys/mailman exists but mailman isn't running, and `service mailman status' is executed, the script just prints 'mailman is stopped' and exits with code 3. In this case, it should say that it's dead but its subsys is locked, and exit with code 2.

* when no known parameter is passed to the init script, it should exit with
code 2, not 3.


Version-Release number of selected component (if applicable):
mailman-2.1.12-4.fc11

Additional info:
See https://fedoraproject.org/wiki/Packaging/SysVInitScript for details.

Comment 1 Daniel Novotny 2009-09-21 12:50:34 UTC
Created attachment 361918 [details]
a proposed patch to address those issues

Comment 2 Radek Bíba 2009-09-21 13:24:38 UTC
Thanks, the patch isn't perfect, though.

* `service mailman stop` when it's already stopped now prints:

Shutting down mailman: No child with pid: 24270
[Errno 3] No such process
Stale pid file removed.
cat: /var/lock/mailman/master-qrunner: No such file or directory  ]

* `try-restart' wasn't added among options in the usage message.

Comment 3 Daniel Novotny 2009-09-21 13:34:47 UTC
thanks,

try-restar fix is straightforward, I will analyze the pidfile thing

Comment 4 Daniel Novotny 2009-10-05 11:24:20 UTC
Created attachment 363654 [details]
a new version of the patch

try-restart fixed, stopping when stopped fixed

Comment 5 Radek Bíba 2009-10-06 11:11:26 UTC
Unfortunately this version broke `status':
# service mailman start
Starting mailman:                                          [  OK  ]
# echo $?
0
# service mailman status
mailman dead but subsys locked
# /usr/lib64/mailman/bin/mailmanctl status
mailman (pid 7535) is running...

Note that while the lock file is named mailman, the process isn't.

Comment 6 Radek Bíba 2009-10-06 11:20:44 UTC
Umm, it was already broken in the previous patch, but I didn't get that far when verifying it.

Comment 7 Daniel Novotny 2009-10-06 13:58:14 UTC
Created attachment 363839 [details]
3rd version of the patch

OK, let's handle "status" as before, but with a special case when the lock file exists

Comment 8 Radek Bíba 2009-10-06 14:24:24 UTC
Works great. Thanks!

Comment 9 Daniel Novotny 2009-10-07 10:53:00 UTC
fixed in rawhide: mailman-2.1.12-10.fc13


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