Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 866283 Details for
Bug 910589
app-eselect/eselect-php: openrc script calls external commands (eselect) in global scope (was: sys-apps/openrc-0.47.1 /usr/bin/eselect line 65 /dev/fd/63 No such file or directory)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch
0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch (text/plain), 2.58 KB, created by
Michael Orlitzky
on 2023-07-25 22:14:38 UTC
(
hide
)
Description:
0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch
Filename:
MIME Type:
Creator:
Michael Orlitzky
Created:
2023-07-25 22:14:38 UTC
Size:
2.58 KB
patch
obsolete
>From e5996098c14a91d52deef357f0ca7f881af512fe Mon Sep 17 00:00:00 2001 >From: Michael Orlitzky <mjo@gentoo.org> >Date: Tue, 25 Jul 2023 17:26:57 -0400 >Subject: [PATCH 1/1] openrc/init.d/php-fpm.in.in: don't run eselect during > sysinit. > >OpenRC caches its dependency tree at boot time, before any non-boot >services have started. It does this by sourcing service scripts, which >means that running commands in global scope is dangerous because they >may not be available yet. In bug 910589 we witness this with a call to >eselect in the php-fpm service script, which in turn runs realpath, >and can fail: > > /usr/bin/eselect line 65 /dev/fd/63 No such file or directory > /usr/share/eselect/libs/path-manipulations.bash: line 66 realpath : > No such file or directory > >Since there are no dependencies for the php-fpm service, and since no >other parts of the service script are cached at that time (source: >prayer), the error is harmless. This commit essentially hides it: we >now check if the RC_RUNLEVEL is "sysinit" and skip the PHP_SLOT >computation if it is. > >Signed-off-by: Michael Orlitzky <mjo@gentoo.org> >Bug: https://bugs.gentoo.org/910589 >--- > openrc/init.d/php-fpm.in.in | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > >diff --git a/openrc/init.d/php-fpm.in.in b/openrc/init.d/php-fpm.in.in >index 3e67e3c..79300b6 100644 >--- a/php-fpm >+++ b/php-fpm >@@ -17,9 +17,21 @@ > # > > PHP_SLOT="${SVCNAME#php-fpm-}" >-if [ "${PHP_SLOT}" = "php-fpm" ] ; then >- # Getting the saved slot allows for clean stops when upgrading to a new slot >- # This will initially be empty on start and fall through to the default >+ >+# OpenRC caches service dependencies at boot time (in the sysinit >+# runlevel), before any non-boot services are started. If we try to >+# run eselect then, it can fail, producing a scary error message (bug >+# 910589). For now, the error message is harmless, but we may be >+# relying on an implementation detail to make that claim: it's >+# important that no other parts of this script are cached when its >+# dependencies are. Nevertheless -- for now at least -- we can avoid >+# the error message by skipping the call to eselect in the sysinit >+# runlevel, because our (empty) depend() function does not use >+# PHP_SLOT in any way. >+if [ "${PHP_SLOT}" = "php-fpm" ] && [ "${RC_RUNLEVEL}" != "sysinit" ]; then >+ # Getting the saved slot allows for clean stops when upgrading to >+ # a new slot This will initially be empty on start and fall >+ # through to the default > PHP_SLOT="$(service_get_value PHP_SLOT)" > if [ -z "${PHP_SLOT}" ]; then > PHP_SLOT="$(eselect php show fpm)" >-- >2.39.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 910589
: 866283