Skip to content

Fix unbound cnf variable.

This PR fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=927338

Tested locally. Before:

Could not find the database of available applications, run update-command-not-found as root to fix this
Sorry, command-not-found has crashed! Please file a bug report at:
http://www.debian.org/Bugs/Reporting
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.7.3 candidate 1
Distributor ID:	Pureos
Description:	PureOS
Release:	testing/unstable
Codename:	n/a
Exception information:

local variable 'cnf' referenced before assignment
Traceback (most recent call last):
  File "/usr/share/command-not-found/CommandNotFound/util.py", line 23, in crash_guard
    callback()
  File "/usr/lib/command-not-found", line 93, in main
    if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg:
UnboundLocalError: local variable 'cnf' referenced before assignment

After:

Could not find the database of available applications, run update-command-not-found as root to fix this
invalid: command not found

I still have to figure out why the application database is not populated even after running update-command-not-found, but at least the main error message gets displayed without the stacktrace.

@jak could you take a look please 👁 ?

Merge request reports

Loading