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
  • When you do that do you get any response at all? – John Militer May 13 '16 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. – Emmanuel May 13 '16 at 15:42
  • Works as expected on Debian 4.3.42(1)-release. Do you have a command_not_found_handle function? – derobert May 13 '16 at 16:12
9

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.

  • Thank you, I think I will consider to use a different shell. – Emmanuel May 13 '16 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) – cas May 14 '16 at 2:19
  • Note that whatever this bug was, it's fixed now. – mattdm Jan 25 '18 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 .... – mattdm Jan 25 '18 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 ... – mattdm Jan 25 '18 at 9:33

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.