Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 626496 - app-eselect/eselect-php-0.9.4: php-fpm-launcher-r1 bashisms
Summary: app-eselect/eselect-php-0.9.4: php-fpm-launcher-r1 bashisms
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-29 02:02 UTC by Thomas Arnett
Modified: 2017-07-29 12:30 UTC (History)
1 user (show)

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


Attachments
working script (php-fpm-launcher-r2,203 bytes, application/x-shellscript)
2017-07-29 02:07 UTC, Thomas Arnett
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Arnett 2017-07-29 02:02:16 UTC
"source" is a bash builtin. This fails if /bin/sh is another shell. This is a critical error, but the script continues to run.

"shift" fails if there are no arguments. bash continues to run, but dash exits.

Reproducible: Always

Steps to Reproduce:
USE="fpm" emerge php eselect-php
emerge app-shells/dash eselect-sh
eselect sh set dash
/usr/libexec/php-fpm-launcher
Actual Results:  
/usr/libexec/php-fpm-launcher: 3: /usr/libexec/php-fpm-launcher: source: not found
/usr/libexec/php-fpm-launcher: 7: shift: can't shift that many
Comment 1 Thomas Arnett 2017-07-29 02:07:33 UTC
Created attachment 487138 [details]
working script

Linted with shellcheck 0.4.6, tested with app-shells/dash-0.5.9.1-r1.
Comment 2 Michael Orlitzky gentoo-dev 2017-07-29 12:30:54 UTC
Thanks, as a dash user, I probably should have caught that. Also, TIL about eselect-sh.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79f7e50ba7490e41619feb1bed61f47c8552c8fa

commit 79f7e50ba7490e41619feb1bed61f47c8552c8fa
Author: Michael Orlitzky <mjo@gentoo.org>
Date:   Sat Jul 29 08:25:37 2017 -0400

    app-eselect/eselect-php: new revision to fix bashisms.

    Thomas Arnett pointed out two bashisms in our php-fpm launcher, and
    provided a new script that works with app-shells/dash. This commit
    updates the launcher, and revisions the v0.9.4 ebuild to use it. I
    fixed the live ebuild while I was at it.

    Gentoo-Bug: 626496