ea-passenger-runtime selects /usr/bin/python-html2text as default Python interpreter (locale-dependent sort)
Environment
- OS: AlmaLinux 9 (el9)
- cPanel & WHM: 138.0 (build 15)
- ea-passenger-runtime-1.0-2.10.1.cpanel.x86_64
- python3-html2text-2020.1.16-5.el9.noarch (EPEL), installed by the cPanel installer itself
(dnf history: "install aspell at bind ... python3-dns python3-html2text python3-setuptools ...")
- System locale: LC_COLLATE="en_US.UTF-8"
Symptom
Starting an application in cPanel » Application Manager fails with:
"The required parameters are invalid or missing. Error #1: Invalid configuration for the parameter "python""
The app's stored setting was "python": "/usr/bin/python-html2text", which is the html2text
CLI wrapper, not a Python interpreter. /etc/cpanel/ea4/passenger.python and
/etc/cpanel/ea4/passenger.python.system-default both pointed to the same path.
Root cause
/usr/local/bin/ea-passenger-runtime-applications-settings, line 149:
find /usr/bin -name 'python*' -executable ! -name "*-config" ! -name "pythonw*" | sort -r | head -n 1
1. The pattern 'python*' matches non-interpreter binaries (python-html2text, python3-html2text).
2. sort -r uses the system locale. Under en_US.UTF-8, punctuation is ignored at the first
collation level and digits sort before letters, so "python-html2text" sorts above "python3.9".
Reproduction (same server):
... | sort -r -> /usr/bin/python-html2text (first)
... | LC_ALL=C sort -r -> /usr/bin/python3.9 (first)
3. _verify_default() and _verify_passenger_setting() only test "-x", so the wrong value is
reported as valid:
"Default python, /usr/bin/python-html2text, is ok"
Impact
- New Passenger apps inherit an invalid python path and cannot be started.
- The ea-passenger-runtime %posttrans scriptlet runs "--fix" on every install/update, which
re-applies the wrong default.
- Running "--fix" manually, as recommended in the "Using Passenger Applications" docs, does
not fix the problem; it reproduces it.
- python3-html2text is installed by the cPanel installer, so any EL9 server with a UTF-8
locale is likely affected.
Suggested fix
- Match only interpreter names and sort deterministically, e.g.:
find /usr/bin -regextype posix-extended -regex '.*/python[0-9]+(\.[0-9]+)?' -executable | LC_ALL=C sort -V | tail -n 1
- Validate that the candidate is a working interpreter instead of only testing -x, e.g.:
"$candidate" -c 'import sys; print(sys.version_info[0])'
- Apply the same review to the ruby* and node* patterns, which use the same approach.
Workaround applied
Set /etc/cpanel/ea4/passenger.python to /usr/bin/python3 and corrected the "python" field in
/var/cpanel/userdata/<user>/applications.json. --fix preserves this because the value is
executable. The package-owned system-default symlink still points to python-html2text.
-
Hey there! I'm going some research on this and I'll let you know once I've filed a case with the team.
0 -
I've created case CPANEL-57843 for our developers to take a look at this. I've also linked this thread to the case so if I hear any updates on my end I'll be sure to post!
0
Please sign in to leave a comment.
Comments
2 comments