Summary: | 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) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | David Duchesne <aether> |
Component: | Current packages | Assignee: | PHP Bugs <php-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ionen, mjo |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=761319 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | 0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch |
Description
David Duchesne
2023-07-20 12:48:19 UTC
>/usr/bin/eselect line 65 /dev/fd/63 No such file or directory would happen if eselect is used before /proc is mounted, possible(?) some openrc script you have installed is using it in depend() which sounds a bit dodgy in other words I think this can be considered a bug for that script rather than openrc >/usr/share/eselect/libs/path-manipulations.bash: line 66 realpath : No such file or directory realpath is not in /bin if you were using a /usr on a separate partition, again likely caused by depend() being made to use eselect too early it may also be missing if using some embedded setup without coreutils, albeit it's getting officially added to POSIX last I know of (In reply to Ionen Wolkens from comment #1) > >/usr/share/eselect/libs/path-manipulations.bash: line 66 realpath : No such file or directory > realpath is not in /bin if you were using a /usr on a separate partition, > again likely caused by depend() being made to use eselect too early oh wait, nevermind that bit -- given the former didn't work (/dev/fd bit is used to adjust PATH), I guess PATH is mangled (In reply to Ionen Wolkens from comment #2) > oh wait, nevermind that bit -- given the former didn't work (/dev/fd bit is > used to adjust PATH), I guess PATH is mangled eselect did make recent change in that regard, albeit I don't think it really supports being used without /proc in the first place anyhow, `grep -r eselect /etc/init.d /etc/conf.d` should tell us what is using eselect on your system, assuming it's not being indirectly used through another command Thanks Ionen! I think it is related to php-fpm then (installed recently to try the new rutorrent ebuild) grep -r eselect /etc/init.d /etc/conf.d /etc/init.d/php-fpm:# whatever the currently-eselected fpm implementation is. In that /etc/init.d/php-fpm:# actual slot by querying eselect. /etc/init.d/php-fpm:# slot php7.1 eselected, but also a php-fpm-php7.1 init script. Should /etc/init.d/php-fpm: PHP_SLOT="$(eselect php show fpm)" eselect php show php-fpm !!! Error: Please choose one of the following modules: cli apache2 fpm cgi phpdbg I forgot to configure it. For now, I can't reboot right now but I'll give an update later. Yep, that explains it then. I thought it'd be depend(), but global scope would cause the same issue. There's no guarantee the system is ready to use any external commands while calculating dependencies or sourcing the script to accomplish that. The script is from eselect-php: https://gitweb.gentoo.org/proj/eselect-php.git/tree/openrc/init.d/php-fpm.in.in?id=1c6a7ab#n25 Fortunately I don't believe this is harmful beside being noisy. So it can be safely ignored until this is fixed. After : eselect php set fpm php8.1 the error message still appears at boot. Otherwise, php-fpm starts fine. If dev-lang/php is not installed then the message no longers shows up (obviously) Thanks ionen for the hint! Sorry, we've known that this is a mess for a while. There's some discussion on bug #761319 about how to fix it. Basically, we need to throw out the eselect magic and make slotted php-fpm work like slotted postgresql, with one init script per slot. It may be possible to hide the error in the meantime though. I'll think about it and try to hack something together. Created attachment 866283 [details, diff]
0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch
Can you try this patch to make sure it solves your problem? I've already edited the src/dst filenames so that you can apply it in /etc/init.d with -p1.
If it works for you, I'll release a new version of eselect-php with the fix.
(In reply to Michael Orlitzky from comment #9) > Created attachment 866283 [details, diff] [details, diff] > 0001-openrc-init.d-php-fpm.in.in-don-t-run-eselect-during.patch > > Can you try this patch to make sure it solves your problem? I've already > edited the src/dst filenames so that you can apply it in /etc/init.d with > -p1. > > If it works for you, I'll release a new version of eselect-php with the fix. Hello, tested and working 100%. Cheers! The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=104abf95fed7fb8bb0d1078627beaa32ae23013a commit 104abf95fed7fb8bb0d1078627beaa32ae23013a Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2023-07-25 21:26:57 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2023-07-25 22:11:35 +0000 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(-) The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49ab2317e4577179b8a2655479dd43d4dbd1d02c commit 49ab2317e4577179b8a2655479dd43d4dbd1d02c Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2023-07-27 02:58:33 +0000 Commit: Michael Orlitzky <mjo@gentoo.org> CommitDate: 2023-07-27 03:00:32 +0000 app-eselect/eselect-php: add 0.9.9 Closes: https://bugs.gentoo.org/910589 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> app-eselect/eselect-php/Manifest | 1 + app-eselect/eselect-php/eselect-php-0.9.9.ebuild | 39 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) |