Bug 444702 - Debug output of shell does not display utf characters, but rather their octal values
Debug output of shell does not display utf characters, but rather their octal...
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: bash (Show other bugs)
4.6
All Linux
medium Severity medium
: rc
: ---
Assigned To: Roman Rakus
Ben Levenson
:
Depends On:
Blocks: 447836
  Show dependency treegraph
 
Reported: 2008-04-30 02:27 EDT by Norm Murray
Modified: 2014-01-12 19:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-29 08:54:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Test script (60 bytes, application/octet-stream)
2008-04-30 02:27 EDT, Norm Murray
no flags Details

  None (edit)
Description Norm Murray 2008-04-30 02:27:02 EDT
On the debugmode (-x) of bash, japanese string is not outputed correctly. This
can be reproduced with following simple step.

===========================================
(in japanese environment with utf8)
$ locale
LANG=ja_JP.UTF-8
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=

$ bash -x -c "echo \"あいうえお\""
+ echo $'\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212'
あいうえお
==================================

The real result of bash is correct. Japanese string is outputed.
But, the debug information by -x option is not the correct japanese string.
Actually, this is the octal digits in utf8 of this japanese string.

As the result, it seems that the bash has the string data of command (like echo...)
as the octal numbers. In debugmode (-x opition), the octal numbers is outputed
as is. This octal numbers should be translated before outputing in debugmode.

         * Observed behavior

On the debugmode of the bash command, japanese string is not outputed correctly.
Instead of that, octal string is outputed.

         * Desired behavior

On the debugmode of the bash command, japanese string should be outputed properly.
Comment 1 Norm Murray 2008-04-30 02:27:02 EDT
Created attachment 304184 [details]
Test script
Comment 2 Roman Rakus 2008-05-21 11:24:24 EDT
As bash -c "help set" says:

        -v  Print shell input lines as they are read.
        -x  Print commands and their arguments as they are executed.

In this case I think this is right behavior. If you want to see japanese string
use -v option.
Comment 4 RHEL Product and Program Management 2008-05-29 08:54:26 EDT
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request. 

Note You need to log in before you can comment on or make changes to this bug.