Re: [gentoo-dev] [PATCH] openrc: make exit codes comply with Linux Standard Base

2011-01-08 Thread Mike Frysinger
On Saturday, January 08, 2011 17:21:18 Eray Aslan wrote:
> On Sat, Jan 08, 2011 at 05:09:21PM -0500, Mike Frysinger wrote:
> > this belongs in bugzilla, not the gentoo-dev mailing list
> 
> Well, this is the upstream ML

which might be relevant if we were talking about a project dedicated to a 
package or two, but we arent.  this is a general distro development list, not 
random sub-projects that happen to come out of it.  same goes for sandbox, or 
catalyst, or genkernel, or crossdev, or gli, or ...

also, nowhere in the openrc package does it indicate the gentoo-dev mailing 
list should be used for reporting.  it does say explicitly to use bugs.g.o 
though.  it also mentions Roy's old site, but i'll fix that.
-mike


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] [PATCH] openrc: make exit codes comply with Linux Standard Base

2011-01-08 Thread Eray Aslan
On Sat, Jan 08, 2011 at 05:09:21PM -0500, Mike Frysinger wrote:
> this belongs in bugzilla, not the gentoo-dev mailing list

Well, this is the upstream ML but anyway, no big deal:

https://bugs.gentoo.org/show_bug.cgi?id=351160

-- 
Eray Aslan
Developer, Gentoo Linux   eras  gentoo.org


pgp0j1t4ekdHW.pgp
Description: PGP signature


Re: [gentoo-dev] [PATCH] openrc: make exit codes comply with Linux Standard Base

2011-01-08 Thread Mike Frysinger
On Saturday, January 08, 2011 18:51:36 Eray Aslan wrote:
> The trivial patch below makes openrc comply with LSB.  I am not aware of
> any service depending on the changed behaviour.

this belongs in bugzilla, not the gentoo-dev mailing list
-mike


signature.asc
Description: This is a digitally signed message part.


[gentoo-dev] [PATCH] openrc: make exit codes comply with Linux Standard Base

2011-01-08 Thread Eray Aslan
Linux Standard Base[1] states that for init scripts:

* status command for a stopped service should have a return code of 3
* starting an already started service or stopping an already stopped
service should be considered as successful

The trivial patch below makes openrc comply with LSB.  I am not aware of
any service depending on the changed behaviour.

Use case:  One can use Gentoo init scripts with cluster management
software - such as sys-cluster/pacemaker - instead of writing a resource
agent or trying to work around their limitations for each managed
service.

[1]
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html


Signed-off-by: Eray Aslan 
---
 sh/runscript.sh.in |2 +-
 src/rc/runscript.c |   12 
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 3d7252a..ea40573 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -89,7 +89,7 @@ _status()
return 0
else
einfo "status: stopped"
-   return 1
+   return 3
fi
 }
 
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index f3f0517..a264535 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -596,8 +596,10 @@ svc_start_check(void)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
 
-   if (state & RC_SERVICE_STARTED)
-   ewarnx("WARNING: %s has already been started", applet);
+   if (state & RC_SERVICE_STARTED) {
+   einfo("%s has already been started", applet);
+   exit(EXIT_SUCCESS);
+   }
else if (state & RC_SERVICE_INACTIVE && !in_background)
ewarnx("WARNING: %s has already started, but is inactive",
applet);
@@ -845,8 +847,10 @@ svc_stop_check(RC_SERVICE *state)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
 
-   if (*state & RC_SERVICE_STOPPED)
-   ewarnx("WARNING: %s is already stopped", applet);
+   if (*state & RC_SERVICE_STOPPED) {
+   einfo("%s is already stopped", applet);
+   exit(EXIT_SUCCESS);
+   }
 
rc_service_mark(service, RC_SERVICE_STOPPING);
hook_out = RC_HOOK_SERVICE_STOP_OUT;
-- 
1.7.3.4


pgpUIPqeqKJny.pgp
Description: PGP signature