command-not-found clashes with local python3 in path
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
command-not-found (Ubuntu) |
Fix Released
|
Undecided
|
Adam Conrad | ||
Xenial |
Fix Released
|
Undecided
|
Adam Conrad |
Bug Description
In Ubuntu 14.04 (and Linux Mint 17), /etc/bash.bashrc handles "command not found" with the function command_
/usr/bin/python /usr/lib/
However, /usr/lib/
if sys.version < '3':
# We might end up being executed with Python 2 due to an old
# /etc/bash.bashrc.
import os
if "COMMAND_
This catches old versions of python and re-runs command-not-found with python3 from the path. If a local version of Python (such as Anaconda) is installed, command-not-found will try to execute with the local python3 and gives:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f04862de740 (most recent call first):
Aborted
This can be solved by replacing line 22 of /usr/lib/
os.execv(
Searching for "os.execvp", it doesn't appear that the same error occurs for any other scripts in /usr/lib/. Any script using os.execvp with the correct permissions is a potential security vulnerability if the path is changed to contain a malicious script under the correct name. Fortunately this is not the case for command-not-found.
description: | updated |
Changed in command-not-found (Ubuntu): | |
assignee: | nobody → Adam Conrad (adconrad) |
Changed in command-not-found (Ubuntu Xenial): | |
assignee: | nobody → Adam Conrad (adconrad) |
status: | New → In Progress |
This bug was fixed in the package command-not-found - 0.3ubuntu16.10.0
---------------
command-not-found (0.3ubuntu16.10.0) yakkety; urgency=medium
* command-not-found: Specify full path to python3 (LP: #1585696) actor/scan. data-old on clean.
* debian/rules: rm UnifiedDataExtr
* Update data for yakkety, and add s390x database (LP: #1593592)
-- Adam Conrad <email address hidden> Fri, 17 Jun 2016 00:41:31 -0600