Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349426 - dev-lang/php-5.3.4: remove bashism from init.d php-fpm script
Summary: dev-lang/php-5.3.4: remove bashism from init.d php-fpm script
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-22 23:00 UTC by Kai Krakow
Modified: 2011-05-22 06:32 UTC (History)
1 user (show)

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


Attachments
Proper posix sh init script + fixes for PHPSLOT, now it should call right binary, not default. (php-fpm_init.patch,1.32 KB, patch)
2010-12-28 12:17 UTC, Piotr Karbowski (RETIRED)
Details | Diff
new init script. (php-fpm-r4.init,1.35 KB, text/plain)
2011-01-26 09:05 UTC, Piotr Karbowski (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Krakow 2010-12-22 23:00:10 UTC
The php-fpm script features bashisms not compatible if you're using a strictly posix shell like "dash" for booting the system (eg by pointing the sh-symlink to dash). The following lines need to be replaced:


--- php-fpm.orig        2010-12-22 23:56:57.948982834 +0100
+++ php-fpm     2010-12-22 23:59:21.339678933 +0100
@@ -2,7 +2,7 @@
 
 PHPSLOT=${SVCNAME#php-fpm-}
 
-if [[ $PHPSLOT == "php-fpm" ]]; then
+if [ $PHPSLOT = "php-fpm" ]; then
        PHPSLOT=$(eselect php show fpm)
 else
        PHPSLOT=php${PHPSLOT}
@@ -25,12 +25,12 @@
         start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec /usr/bin/php-fpm -- -y "${PHP_FPM_CONF}"
         local i=0
         local timeout=5
-        while [[ ! -f ${PHP_FPM_PID} ]] && [[ $i -le $timeout ]]; do
+        while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do
             sleep 1
             i=$(($i + 1))
         done
         
-        [[ $timeout -gt $i ]]
+        [ $timeout -gt $i ]
         eend $?
 }
 
@@ -42,6 +42,6 @@
 
 reload() {
     ebegin "Reloading PHP FastCGI Process Manager"
-    [[ -f ${PHP_FPM_PID} ]] && kill -USR2 $(cat ${PHP_FPM_PID})
+    [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
     eend $?
 }


Reproducible: Always
Comment 1 Piotr Karbowski (RETIRED) gentoo-dev 2010-12-23 12:22:58 UTC
+1
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-12-27 21:51:02 UTC
Please attach a patch (diff -u) so it is easier to apply (without mistakes). Thanks.
Comment 3 Piotr Karbowski (RETIRED) gentoo-dev 2010-12-28 12:17:08 UTC
Created attachment 258251 [details, diff]
Proper posix sh init script + fixes for PHPSLOT, now it should call right binary, not default.
Comment 4 Gordon Pettey 2011-01-02 20:30:24 UTC
After applying the patch, everything between #!/sbin/runscript and opts="depend start stop reload" should probably be moved to /etc/conf.d/php-fpm.
Comment 5 Matti Bickel (RETIRED) gentoo-dev 2011-01-25 23:14:42 UTC
Ole, can you take a look at this? We could push this with a revbump sometime this/next week.
Comment 6 Piotr Karbowski (RETIRED) gentoo-dev 2011-01-26 09:04:25 UTC
There is updated version in overlay, php-fpm-r4.init.
Comment 7 Piotr Karbowski (RETIRED) gentoo-dev 2011-01-26 09:05:59 UTC
Created attachment 260745 [details]
new init script.
Comment 8 Ole Markus With (RETIRED) gentoo-dev 2011-05-22 06:32:36 UTC
The bash stuff was actually removed some time ago.