Bug 725182

Summary: bash incorrect showing "command not found" message with non-Latin symbols
Product: [Fedora] Fedora Reporter: Alexei Panov <me>
Component: bashAssignee: Roman Rakus <rrakus>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 15CC: bugs.michael, lemenkov, maxamillion, perchibald, rrakus, tawakiy, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-25 13:17:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
screenshot of the error none

Description Alexei Panov 2011-07-23 19:11:48 UTC
Created attachment 514884 [details]
screenshot of the error

Description of problem:
in gnome-terminal, konsole or text console I run the command:
$ йцу
and bash showing message:
bash: $'\320\271\321\206\321\203': command not found

But normal message assumed to be:
bash: 'йцу': command not found

@gnome-desktop group includes PackageKit-command-not-found package with /etc/profile.d/PackageKit.sh file. With this file bug doesn't occur. If I'll remove this file, bug present.

Version-Release number of selected component (if applicable):
bash 4.2.10-4.fc15 and all >= 4.2.0-0.1.rc2.fc15

How reproducible:
Always

Steps to Reproduce:
1. add Russian or other nation keyboard layout
2. open any terminal (as example konsole, gnome-terminal)
3. try run command with national symbols (non-Latin), as example 'йцу' in Russian (keys qwe in Latin keyboard) or other.
  
Actual results:
bash: $'\320\271\321\206\321\203': command not found
message with unicode codes

Expected results:
bash: 'йцу': command not found
message without unicode codes, but with full name command

Additional info:
I've test different versions bash for Fedora 15 from koji.
For bash, version =< 4.1.9-5, bug is not present.

Comment 1 tawakiy 2011-07-23 19:15:41 UTC
Bug confirmed with Russian and Ukrainian symbols. bash version — bash.i686 4.2.10-4.fc16.

Comment 2 Peter Lemenkov 2011-07-23 19:47:30 UTC
I can confirm this as well. Fortunately it's not a very crucial issue - I'd rather call it "papercut".

Comment 3 Alex Pepper 2011-07-24 09:05:20 UTC
Confirm. bash.i686 4.2.10-4.

Comment 4 Roman Rakus 2011-07-25 10:38:24 UTC
Thanks for the report

(In reply to comment #0)
> Created attachment 514884 [details]
> screenshot of the error
> 
This wasn't necessary.

> Description of problem:
> in gnome-terminal, konsole or text console I run the command:
> $ йцу
> and bash showing message:
> bash: $'\320\271\321\206\321\203': command not found
Do you have correctly set locales?
Bash prints the filenames in this format when there are not printable characters in the filename (using isprint function).
In fact there is bug in `./йцу' command execution format. In this case bash doesn't check characters.
Try to execute $'\x0Ba\n\r\x0B' and ./$'\x0Ba\n\r\x0B'

> 
> But normal message assumed to be:
> bash: 'йцу': command not found
> 
> @gnome-desktop group includes PackageKit-command-not-found package with
> /etc/profile.d/PackageKit.sh file. With this file bug doesn't occur. If I'll
> remove this file, bug present.
There are few bugs in that script. Thanks for pointing me there.

> 
> Version-Release number of selected component (if applicable):
> bash 4.2.10-4.fc15 and all >= 4.2.0-0.1.rc2.fc15
> 
> How reproducible:
> Always
> 
> Steps to Reproduce:
> 1. add Russian or other nation keyboard layout
> 2. open any terminal (as example konsole, gnome-terminal)
> 3. try run command with national symbols (non-Latin), as example 'йцу' in
> Russian (keys qwe in Latin keyboard) or other.
> 
> Actual results:
> bash: $'\320\271\321\206\321\203': command not found
> message with unicode codes
> 
> Expected results:
> bash: 'йцу': command not found
> message without unicode codes, but with full name command
> 
> Additional info:
> I've test different versions bash for Fedora 15 from koji.
> For bash, version =< 4.1.9-5, bug is not present.
I will check older versions and locale settings

Comment 5 Alexei Panov 2011-07-25 11:18:53 UTC
Thank you for fast answer Roman.

> Do you have correctly set locales?
Yes, locale set correctly, I've set locale over system-config-language.
$ cat /etc/sysconfig/i18n 
LANG="ru_RU.UTF-8"

$ locale 
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

I've execute you commands, and that a result:
[alex@alex-desktop ~]$ $'\x0Ba\n\r\x0B'
bash: 
      a: команда не найдена...
[alex@alex-desktop ~]$ ./$'\x0Ba\n\r\x0B'
bash: ./
        a

: Нет такого файла или каталога
[alex@alex-desktop ~]$ LANG=C $'\x0Ba\n\r\x0B'
bash: 
      a: command not found...
[alex@alex-desktop ~]$ LANG=C ./$'\x0Ba\n\r\x0B'
bash: ./
        a

: Нет такого файла или каталога

"Нет такого файла или каталога" in English "No such file or directory"

Thanks.

Comment 6 Roman Rakus 2011-07-25 13:11:01 UTC
Bash is using only `isprint' function, but chould also use `iswprint'.

Comment 7 Roman Rakus 2011-08-16 14:16:15 UTC
Patches sent upstream
https://lists.gnu.org/archive/html/bug-bash/2011-08/msg00214.html

Comment 8 Roman Rakus 2011-08-25 13:17:49 UTC
It will be fixed in next bash release.

Comment 9 Alexei Panov 2011-08-25 14:01:34 UTC
Thanks, Roman. We will wait new release.

Comment 10 Michael Schwendt 2012-12-21 19:44:58 UTC
This is reproducible on F18. Regression?

  $ rpm -q bash
  bash-4.2.39-3.fc18.x86_64
  $ rpm -q PackageKit-command-not-found
  package PackageKit-command-not-found is not installed

Comment 11 Roman Rakus 2013-01-02 12:01:07 UTC
(In reply to comment #10)
> This is reproducible on F18. Regression?
> 
>   $ rpm -q bash
>   bash-4.2.39-3.fc18.x86_64
>   $ rpm -q PackageKit-command-not-found
>   package PackageKit-command-not-found is not installed

Thanks for check.
The patch is accepted upstream, however there is no new release. Maybe it will be released in version 4.3.