7

I just noted this on bash 4.3; exact version number is 4.3.42(1)-release (x86-redhat-linux-gnu).

$ ..
$ ...
$ ....
$ .....

Why do the "command not found" is not prompted ?

$ ...
$ echo $? 
$ 127

I checked the $PATH and the alias nothing; The man is not helping neither.
The bash run on Fedora Linux, but I think it is not related to the OS.

EDIT

I just noted this it the same for any dot starting command

.za
.zaza
..za
..zaza
ilkkachu
148k16 gold badges268 silver badges440 bronze badges
asked May 13, 2016 at 15:34
3
  • When you do that do you get any response at all? Commented May 13, 2016 at 15:38
  • @John Yes it is like I posted here. On my computers I traditionally alias "..." to sudo -s here I forgot to do so, this is how I discovered it. Commented May 13, 2016 at 15:42
  • Works as expected on Debian 4.3.42(1)-release. Do you have a command_not_found_handle function? Commented May 13, 2016 at 16:12

1 Answer 1

10

This was caused by the command-not-found handling in Fedora.

Running an unknown command (including ... etc. if no alias matches) causes command_not_found_handle to be run with the missing command as parameter (see /etc/profile.d/PackageKit.sh for its definition). In the given scenario, the handler then runs /usr/libexec/pk-command-not-found, again with the missing command as parameter. Previously, pk-command-not-found simply ignored any command starting with .:

if (argv[1][0] == '.')
 goto out;

and exited with code 127.

This behaviour was introduced to fix Red Hat #1151185, is also referenced in Bash does not print any error msg upon non-existing commands starting with dot, and has a bug requesting a fix (Red Hat #1292531). It’s largely been fixed in FC 27 with updates, since PackageKit 1.1.8 (see this commit): now commands with leading dots are processed, only . and .. are ignored.

answered May 13, 2016 at 16:12
6
  • Thank you, I think I will consider to use a different shell. Commented May 13, 2016 at 16:32
  • @Emmanuel or you could just disable Fedora's broken command-not-found handler with something like unset -f command_not_found_handle in your ~/.bashrc. Or uninstall whatever Fedora package is providing the command-not-found functionality (on debian, I run apt-get purge command-not-found on every debian box i build. I do the same for the bash-completion package. Both are far more annoying than any benefit they bring) Commented May 14, 2016 at 2:19
  • Note that whatever this bug was, it's fixed now. Commented Jan 25, 2018 at 9:26
  • @StephenKitt Hmmm, weird. Not on mine. I get "command not found" in most of the example cases, and additionally Similar command is: '..' with .... Commented Jan 25, 2018 at 9:32
  • Actually, following your github link in your answer now shows fixed code. This commit from two months ago did it — instead of just looking for a starting ., it checks explicitly for . and ... Commented Jan 25, 2018 at 9:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.