function command_not_found_handle in /etc/bash.bashrc may supress command not found error message
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: bash
In case a user tries to enter a command name containing white space, e.g.
$ "foo bar"
the system doesn't print an error message. Only the return code is correct (127), but nothing else is printed. This may be confusing.
The function command_
But the function definition misses quotes around the program name variable ("$1"), so the white space separates this funny command to more than one word, and the python program seems not to like this.
A simple fix is attached as patch.
tags: | added: patch |
Some examples are shown below. The first one shows the problem - no error message, but correct return code. The second one shows the expected behaviour for a not available command without white space in the command name.
rum:~$ foo\ bar
rum:~$ echo $?
127
rum:~$ foo
No command 'foo' found, did you mean:
Command 'fio' from package 'fio' (universe)
Command 'goo' from package 'goo' (universe)
Command 'fop' from package 'fop' (universe)
Command 'fox' from package 'objcryst-fox' (universe)
Command 'xoo' from package 'xoo' (universe)
Command 'zoo' from package 'zoo' (universe)
foo: command not found
rum:~$ echo $?
127
After applying the patch, the expected behaviour is shown:
rum:~$ "foo bar"
foo bar: command not found
rum:~$ echo $?
127