When using the bash source command command-not-found behaves as if it was interactive

Bug #1813124 reported by Tom Rosenfeld
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
command-not-found (Ubuntu)
New
Undecided
Unassigned

Bug Description

When using the bash "source" command from an interactive shell it is
 1) very slow
 2) pressing Control-C repeatedly reports python errors like:
Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.4/site.py", line 586, in <module>
    main()

This has been verified on Ubuntu 14 and 18.

This can be reproduced by sourcing a file with about 50 lines of a word which is not found.
For example:
  for i in $(seq 50); do echo lss ; done > bad.sh
  source ./bad.sh

output will show something like:
 No command 'lss' found, did you mean:
 Command 'ss' from package 'iproute2' (main)
 Command 'ls' from package 'coreutils' (main)
...

Additionally, if you try to press ^C repeatedly you will get the errors from Python.

I would have expected the command-not-found to behave as if it was in a non interactive shell and not provide
interactive feedback, and not slow down the execution by doing a search that significantly slows the executions.

Thanks,
-tom

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.