Bug 501184

Summary: Header misalignment with multibyte characters
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dwalsh, mgrepl
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: 2010-04-09 08:08:25 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:

Description Göran Uddeborg 2009-05-17 17:03:58 UTC
Description of problem:
The header linse of e.g. "semanage user -l" gets misaligned if the translated headers contain UTF-8 multibyte characters.

Version-Release number of selected component (if applicable):
policycoreutils-2.0.57-11.fc10.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. env LANG=sv_SE.utf8 semanage user -l
  
Actual results:

                Märkning  MLS/       MLS/                          
SELinux-anv.    Prefix     MCS-nivå  MCS-intervall                  SELinux-roller

guest_u         user       s0         s0                             guest_r
root            user       s0         SystemLow-SystemHigh           staff_r sysadm_r system_r unconfined_r
staff_u         user       s0         SystemLow-SystemHigh           staff_r sysadm_r system_r
sysadm_u        user       s0         SystemLow-SystemHigh           sysadm_r
system_u        user       s0         SystemLow-SystemHigh           system_r
unconfined_u    unconfined s0         SystemLow-SystemHigh           system_r unconfined_r
user_u          user       s0         s0                             user_r
xguest_u        user       s0         s0                             xguest_r

I hope bugzilla won't mangle the formatting.  The point here is that "MLS/" is one space to the left of where it should be.  Likewise with "MCS-intervall" and "SELinux-roller".  Presumably because of the "ä" in "Märkning" and the "å" in "MLS-nivå".

Additional information:
This is shown using a po file I just uploaded where "SELinux-anv." is abbreviated as shown above.  Before it was spelled out "SELinux-användare", which made the header overflow.  It was when I corrected the overflow in the translation I noticed this other problem.

Comment 1 Daniel Walsh 2009-10-28 13:03:16 UTC
Any idea how to fix this?

Comment 2 Göran Uddeborg 2009-11-03 15:27:13 UTC
I didn't have any.  But I took help from some friends/colleagues who know Python much better than I do.  With their advice, and a bit of experimentation, I came up with this fix.  Having applied it, the output looks fine in both sv_SE.utf8 (an UTF-8 locale) and in sv_SE (a Latin-1 locale).

--- /usr/sbin/semanage.orig     2009-06-12 22:24:31.000000000 +0200
+++ /usr/sbin/semanage  2009-11-03 16:14:10.000000000 +0100
@@ -32,7 +32,7 @@
 try:
        gettext.install(PROGNAME,
                        localedir="/usr/share/locale",
-                       unicode=False,
+                       unicode=True,
                        codeset = 'utf-8')
 except IOError:
        import __builtin__

(Well, it WILL look nice after I fixed the translation.  The current version translates "SELinux User" with "SELinux-användare" which doesn't fit in the 15 positions available.  But I will change that to an abbreviation.)

Comment 3 Bug Zapper 2009-11-18 11:58:20 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 4 Göran Uddeborg 2009-11-24 10:27:29 UTC
Remains in policycoreutils-2.0.74-17.fc12.x86_64.  And my little patch from comment 2 still works for me.

Comment 5 Daniel Walsh 2009-11-24 15:36:39 UTC
Fixed in policycoreutils-2.0.77-1.fc12

Comment 6 Göran Uddeborg 2010-04-09 08:08:25 UTC
Does indeed work now.  (Tested with 2.0.79.)