Python3-incompatible exception-handling syntax error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cfget (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
$ lsb_release -rd
Description: Ubuntu 18.04.3 LTS
Release: 18.04
$ apt-cache policy cfget
cfget:
Installed: 0.19-1.1
Candidate: 0.19-1.1
Version table:
*** 0.19-1.1 500
500 http://
500 http://
100 /var/lib/
EXPECTED:
$ cfget -C /etc/os-release UBUNTU_CODENAME
bionic
OBSERVED:
$ cfget -C /etc/os-release UBUNTU_CODENAME
File "/usr/bin/cfget", line 443
raise UserError, "No configuration files specified in %s" % cfgenv
SyntaxError: invalid syntax
DETAILS:
The system on which this exception was raised did not have python2 installed prior to the installation of this package, as is standard for Ubuntu 18.04, but did have the python3 binary registered via update-alternatives as the default python interpreter accessed via `$ python` for compatibility with other software that executes on python3 but expects to be able to invoke itself via the `python` command.
The package was installed via apt without modification, and the only warning that was raised with respect to the existence of a non-standard state of the update-alternatives setting for the `python` command was the following line:
update-
While I understand that manually registering the `python` command to point to python3.6 comes with some measure of responsibility to understand the limitations of the system, and I am pleased that the installation did not override the manually-registered association, it strikes me as incredibly naive to present a software package that explicitly lists python2 as a dependency (that apt installs and ensures is provided via the `python2` command) but assumes in its shebang line (#!/usr/bin/python) that the `python` command will not be non-standard, especially in the context of the decision to set python3 as the only default version of python installed with releases at-or-beyond 18.04.
(I am aware that the official position on the registration of python3 as `python` (as a means to permit packages, which are able to execute under either python version, to execute properly on systems without python2 installed) is that such software should be updated to drop backwards support for python2 and, concurrently, update its shebang declaration to reference the python3 executable explicitly. This seems to me to be a needlessly draconian policy in light of the availability of tools like update-alternatives and the common availability of the version-explicit python2 and python3 commands.)
If this software is too time consuming to quickly revise for python3 (to remove the less-than-desirable dependency on python2), the attached patch should ensure that sysadmins who have elected to configure their servers running modern Ubuntu distros are at least somewhat protected against future discovery of unpatched python2 security issues by registering python3, via update-
The attachment "Clear specification of required python version for execution" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]