command-not-found exits shell, when the current working directory is very long
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
command-not-found |
New
|
Undecided
|
Unassigned |
Bug Description
command-not-found can exit the bash shell, see:
user@ubuntu:~$ export XXX=1
user@ubuntu:~$ bash
user@ubuntu:~$ export XXX=2
user@ubuntu:~$ gedit &
[1] 4711
user@ubuntu:~$ The program 'gedit' is currently not installed. You can install it by typing:
sudo apt install gedit
[1]+ Exit 127 gedit
user@ubuntu:~$ echo $XXX
2
user@ubuntu:~$ mkdir --parent a/very/
user@ubuntu:~$ cd a/very/
user@ubuntu:
[1] 4712
user@ubuntu:
user@ubuntu:~$ The program 'gedit' is currently not installed. You can install it by typing:
sudo apt install gedit
user@ubuntu:~$ echo $XXX
1
Notes:
1. The bug seems to depend on the length of the path and the prompt. With the above
example, the bug seems to be triggered always. When the path is shorter, the bug might
be triggered only sometimes.
2. When I set:
PS1=user@
and stay in my home directory, I cannot trigger this bug.
3. If I set:
PS1=#
and cd into the long directory, I also cannot trigger the bug. Therefore the bug probably
depends on both: a long path and a long prompt.
4. It is necessary to start the not-installed program in the background with & to trigger
this bug.
5. You can also trigger the bug, by mys-typing an installed program.
6. I've seen this bug in 14.04 and 16.04.
7. Setting XXX proves that the bash started in the above example exited. If you try the
above example without starting a bash, the terminal will close, and you probably can't
see the error message.