Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 494302 - net-im/jabberd2-2.2.17-r1: different pid files in default configs and init script
Summary: net-im/jabberd2-2.2.17-r1: different pid files in default configs and init sc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All All
: Normal minor (vote)
Assignee: Julian Ospald
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 493962
  Show dependency tree
 
Reported: 2013-12-15 07:59 UTC by Regna
Modified: 2014-02-22 16:47 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
jabberd.initd (file_494302.txt,1.44 KB, text/plain)
2014-02-22 16:47 UTC, Regna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regna 2013-12-15 07:59:47 UTC
/etc/init.d/jabber uses "/var/run/jabber/$(basename ${cfgfile%.xml}).pid", which becomes /var/run/jabber/c2s.pid, but config files have <pid>/var/run/jabber/jabberd2-c2s.pid</pid>.
As a result, jabber services are starting multiple times (and crashing).

Reproducible: Always

Steps to Reproduce:
1. emerge =net-im/jabberd2-2.2.17-r1;
2. /etc/init.d/jabberd start;
3. /etc/init.d/jabberd start;
Actual Results:  
Jabber services are starting multiple times (and crashing).

Expected Results:  
Jabber services are starting one time and running.

Possible solutions:
1. changing init script;
2. renaming config files to jabberd2-${id};
3. changing pid files in configs;
Comment 1 Julian Ospald 2013-12-15 12:31:16 UTC
	ewarn 'If you are upgrading from <=jabberd2-2.2.17 then you might have'
	ewarn 'to update /etc/jabber/jabberd.cfg via etc-update because'
	ewarn 'the binaries have been renamed to avoid file collisions!'
Comment 2 Julian Ospald 2013-12-15 12:37:39 UTC
oh, I think I misread your report
Comment 3 Julian Ospald 2013-12-15 12:49:20 UTC
+*jabberd2-2.3.1-r1 (15 Dec 2013)
+
+  15 Dec 2013; Julian Ospald <hasufell@gentoo.org> -jabberd2-2.2.17.ebuild,
+  -jabberd2-2.2.17-r1.ebuild, -files/jabberd2-2.2.17.init,
+  -files/jabberd2-2.2.17.logrotate, -jabberd2-2.3.1.ebuild,
+  +jabberd2-2.3.1-r1.ebuild, +files/jabberd2-2.3.1.init,
+  +files/jabberd2-2.3.1.logrotate, +files/jabberd2-2.3.1.pamd:
+  fix init script and revbump wrt #494302, remove old
Comment 4 Julian Ospald 2013-12-15 13:14:42 UTC
it is now grepping the config files to get the appropriate pid

http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-im/jabberd2/files/jabberd2-2.3.1.init?r1=1.1&r2=1.2
Comment 5 Regna 2013-12-15 14:03:07 UTC
Yes, grepping will work in all but one case:
<pidfile>/var/run/jabber/jabberd2-${id}.pid</pidfile>
Jabberd2 will set ${id} to the value of <id> tag, but init script won't.
Comment 6 Julian Ospald 2014-02-20 15:55:35 UTC
(In reply to Regna from comment #5)
> Yes, grepping will work in all but one case:
> <pidfile>/var/run/jabber/jabberd2-${id}.pid</pidfile>
> Jabberd2 will set ${id} to the value of <id> tag, but init script won't.

alternative solution?
Comment 7 Regna 2014-02-22 10:03:19 UTC
1: Expect pid files to be jabberd2-$(basename ${cfgfile%.xml}).pid;
2: Don't rename pids in config templates at all, and use old $(basename ${cfgfile%.xml}).pid;
2: grep for <id> and expect pidfiles to be ${id}.pid (not always same as $(basename ${cfgfile%.xml}).pid);
4: grep for <id>, set it to id variable and replace ${id} in greped pid path.
Comment 8 Julian Ospald 2014-02-22 15:06:33 UTC
(In reply to Regna from comment #7)
> 1: Expect pid files to be jabberd2-$(basename ${cfgfile%.xml}).pid;

not sure how that solves the issue

> 2: Don't rename pids in config templates at all, and use old $(basename
> ${cfgfile%.xml}).pid;

not an option, see bug 241472

> 2: grep for <id> and expect pidfiles to be ${id}.pid (not always same as
> $(basename ${cfgfile%.xml}).pid);

not sure how that solves the issue

> 4: grep for <id>, set it to id variable and replace ${id} in greped pid path.

That's possible, although it does not really improve the ugliness of the current situation.
Comment 9 Regna 2014-02-22 16:47:42 UTC
Created attachment 371064 [details]
jabberd.initd

Initscript for the first (or second) option, pidfile name from config file name.
Tested.