Bug 194321

Summary: Message encoding not converted when ENOMEM error
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: drepper, roland
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0210 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 23:00:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 176344, 198868    

Description Bastien Nocera 2006-06-07 09:57:18 UTC
dlerror (and probably strerror) will not convert the messages from their
original encoding to the current locale's encoding.

This causes EUC-JP messages to appear when in ja_JP.UTF-8 encoding for example.
2 ways to work around this problem:
- say that UTF-8 is the default encoding on RHEL4, and convert all the .po files
from their original encodings to UTF-8 (fairly straight forward, I already
tested this with ja_JP)
- fallback to C locale when the conversion fails, rather than passing non-UTF-8
encoded text back to the program

Test case:
#include <stdio.h>
#include <string.h>
#include <locale.h>
main()
{
        char *msg;
        setlocale(LC_ALL, "");
        msg = strerror(1);/*EPERM*/
        puts(msg);
}

And the gdb script to replicate the memory allocation error:
set height 0
set environment LANG=ja_JP.UTF-8
echo --- Success case ---\n
echo Japanese error message is readable in UTF-8 environment\n
run
break malloc.c:3594
command
return 0
cont
end
echo --- Failure case ---\n
echo Japanese error message is not readable in UTF-8 environment\n
run
quit

Comment 4 RHEL Program Management 2006-08-18 15:38:51 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 Red Hat Bugzilla 2007-05-01 23:00:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0210.html