Bug 501184 - Header misalignment with multibyte characters
Header misalignment with multibyte characters
Product: Fedora
Classification: Fedora
Component: policycoreutils (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-05-17 13:03 EDT by Göran Uddeborg
Modified: 2010-04-09 04:08 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-04-09 04:08:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2009-05-17 13:03:58 EDT
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):

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 09:03:16 EDT
Any idea how to fix this?
Comment 2 Göran Uddeborg 2009-11-03 10:27:13 EST
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 @@
-                       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 06:58:20 EST
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: 
Comment 4 Göran Uddeborg 2009-11-24 05:27:29 EST
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 10:36:39 EST
Fixed in policycoreutils-2.0.77-1.fc12
Comment 6 Göran Uddeborg 2010-04-09 04:08:25 EDT
Does indeed work now.  (Tested with 2.0.79.)

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