Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 390307 - dev-lang/php-5.4.0_rc1 FPM script contains reference to 5.3 slot
Summary: dev-lang/php-5.4.0_rc1 FPM script contains reference to 5.3 slot
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 21:46 UTC by Guillaume Castagnino
Modified: 2012-01-14 14:35 UTC (History)
1 user (show)

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


Attachments
Init script with multi-slot support (php-fpm,1.09 KB, text/plain)
2011-11-14 07:32 UTC, Ole Markus With (RETIRED)
Details
New attempt at a new init script (php-fpm,1.17 KB, text/plain)
2011-11-14 14:50 UTC, Ole Markus With (RETIRED)
Details
Version bar bashisms (php-fpm,1.13 KB, text/plain)
2011-11-15 08:53 UTC, Ole Markus With (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Castagnino 2011-11-12 21:46:21 UTC
The init script installed by php-5.4.0_rc1 for FPM (/etc/init.d/php-fpm) contains reference to 5.3 slot configuration.

So if php:5.3 is installed, php:5.4 uses the 5.3 configuration in /etc/php/fpm-php5.3/ instead of the 5.4 configuration in /etc/php/fpm-php5.4/
And after cleaning the 5.3 slot and removing the corresponding configuration, php-fpm:5.4 logically does not start anymore...

I think that this parameter should be changed by eselect too.
If I understand correctly, currently eselect changes the link /usr/bin/php-fpm. Why not change the configuration directory too and provide a symlink /etc/php/php-fpm -> /etc/php/php-fpm-${SLOT} and then use this link without version number in the init script ?
Comment 1 Ole Markus With (RETIRED) gentoo-dev 2011-11-13 07:05:25 UTC
Thanks for reporting this. I'll whip up some magic soon.
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2011-11-14 07:32:03 UTC
Created attachment 292475 [details]
Init script with multi-slot support
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2011-11-14 07:32:54 UTC
Try the attached init script. It should respect eselect settings, as well as allow you to start multiple versions of php-fpm if you symlink the initscript to something like /etc/init.d/php-fpm-5.4
Comment 4 Piotr Karbowski (RETIRED) gentoo-dev 2011-11-14 07:45:23 UTC
You should put the PHPSLOT detect code in a function, like 'get_phpslot' and call it from start() and stop(). Otherwise the eselect php show fpm will be executed evrytime openrc cache is rebuild, as it does 'source' every init script and it will result in slowing system boot down.
Comment 5 Guillaume Castagnino 2011-11-14 08:45:22 UTC
Works great thanks.

Just one more thing : While you are upgrading the init script, it could be cool to fix the openrc warnings too (nothing to do with this bug but, this could be fixed at the same time ;))

--- php-fpm     2011-11-14 09:38:39.763518132 +0100
+++ /etc/init.d/php-fpm 2011-11-14 09:43:10.809446311 +0100
@@ -10,7 +10,8 @@
 
 PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"
 
-opts="depend start stop reload"
+extra_commands="depend"
+extra_started_commande="reload"
 
 depend() {
        need net
Comment 6 Guillaume Castagnino 2011-11-14 08:50:39 UTC
(In reply to comment #5)
Sorry, there is a typo error : should read extra_started_commands and not extra_started_commande

--- php-fpm     2011-11-14 09:38:39.763518132 +0100
+++ /etc/init.d/php-fpm 2011-11-14 09:43:10.809446311 +0100
@@ -10,7 +10,8 @@

 PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"

-opts="depend start stop reload"
+extra_commands="depend"
+extra_started_commands="reload"

 depend() {
        need net
Comment 7 Ole Markus With (RETIRED) gentoo-dev 2011-11-14 09:13:12 UTC
(In reply to comment #4)
> You should put the PHPSLOT detect code in a function, like 'get_phpslot' and
> call it from start() and stop(). Otherwise the eselect php show fpm will be
> executed evrytime openrc cache is rebuild, as it does 'source' every init
> script and it will result in slowing system boot down.

Probably a very minimal slowdown, but this is easy to implement, so no problem.

(In reply to comment #5)
> -opts="depend start stop reload"
> +extra_commands="depend"
> +extra_started_commande="reload"
> 
>  depend() {
>         need net

How will this work with baselayout-1? Maybe all three variables should be defined?
Comment 8 Guillaume Castagnino 2011-11-14 09:22:58 UTC
More and more init scripts are converted without any condition (look at your init.d dir, even sshd is migrated, no conditionnal at all). And baselayout-1 is no-more in tree (it was remove 2 months ago).
opts is deprecated and openrc mainteners wants to remove opts support : http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=df1f02ac
Comment 9 Guillaume Castagnino 2011-11-14 09:30:06 UTC
In fact, there is a tracker :
https://bugs.gentoo.org/show_bug.cgi?id=381895


If you want, I can open a new bug for that to attach to the tracker to keep track of this change if you want not to polute the phpslot problematic here (sorry for that).
Comment 10 Ole Markus With (RETIRED) gentoo-dev 2011-11-14 14:50:33 UTC
Created attachment 292531 [details]
New attempt at a new init script

Nah, tracking it in this bug is fine. How about this version? I think it should address both problems mentioned.
Comment 11 Piotr Karbowski (RETIRED) gentoo-dev 2011-11-14 15:51:42 UTC
You use bashy string manipulators, and runscript execute /bin/sh, so this will fail hard if your /bin/sh is not symlinked to bash. You should stay with the ${SVCNAME#php-fpm-} or something like it, the #, ##, % and %% is supported by posix sh, sed-alike /string/ is not.
Comment 12 Guillaume Castagnino 2011-11-14 21:51:16 UTC
It's working fine for me, but I'm not expert with bashisms

Thanks !
Comment 13 Ole Markus With (RETIRED) gentoo-dev 2011-11-15 08:53:34 UTC
Created attachment 292609 [details]
Version bar bashisms

Ok. I tested this one using dash, so I hope this will make everyone happy :)
Comment 14 Guillaume Castagnino 2011-11-25 18:32:28 UTC
Just a notice : you have merge the changes to $FILESDIR/php-fpm.init, but the ebuild of php-5.4.0_rc* uses $FILESDIR/php-fpm-r4.init (PHP_FPM_INIT_VER="4")

Thanks !
Comment 15 Piotr Karbowski (RETIRED) gentoo-dev 2011-12-06 10:00:49 UTC
Bump. Init script could use the bump in ~arch.
Comment 16 Ole Markus With (RETIRED) gentoo-dev 2011-12-06 12:27:54 UTC
Sorry it took some time to fix this. Actually, we cannot really support multiple versions of the init script because the different slots would overwrite each other.

Try now and see if it works.
Comment 17 Guillaume Castagnino 2011-12-08 14:26:41 UTC
Looks good to me now. Thanks !