[apparmor] [patch] Run utils tests with C locale

Christian Boltz apparmor at cboltz.de
Sat May 7 12:22:42 UTC 2016


Am Freitag, 6. Mai 2016, 16:34:15 CEST schrieb Seth Arnold:
> On Fri, May 06, 2016 at 10:59:46PM +0200, Christian Boltz wrote:
> > It turned out that test-translations.py reads the system-wide
> > apparmor-utils.mo in addition to the in-tree translations.
> > (I have the 2.11 beta1 translations installed, which contain hotkey
> > conflicts for the german translations).
> >
> > This is surprising because test-translations.py explicitely sets the
> > locale path. Interestingly, this happens only 4 times (checked with
> > a temp profile with audit for those files) while test-translations.py
> > has 9 tests).
> >
> > (Any idea if this behaviour is normal or a bug?)
> >
> > This patch adds LC_ALL=C to the make check and make coverage
> > commandline so that the system-wide translations don't get used.
> This feels like a coincidence of implementation rather than the
> intended effect; is there no better way to do this?

I'd guess this is because the test does stuff normal programs don't ;-)

Normal programs just read the environment variables ($LANG, $LC_ALL,
$LC_MESSAGES etc.)  to decide about the language. OTOH, the test 
explicitely sets the language to use each time it initializes gettext:

        for language in self.languages:
            t = gettext.translation('apparmor-utils', fallback=True, localedir=self.localedir, languages=[language])

fallback=True might be part of the problem, but IIRC I tried with 
fallback=False a while ago and got even funnier results ;-)

And even if fallback=True is part of the problem, things still looks 
inconsistent because the behaviour changes when running with LC_ALL=C...

It might be an interesting exercise to track this down, and I wouldn't
be surprised if it would result in a bugreport. However this would need
much more time than I'm willing to invest ;-)

> > I checked with a modified de.po that in-tree hotkey conflicts still
> > get detected.
> >
> > 
> Acked-by: Seth Arnold <seth.arnold at canonical.com>

I'll commit on monday if nobody comes up with a better solution ;-)


Christian Boltz
["Hallo Welt"-Programm] Und nicht, dass mir jemand die Source klaut.
Die steht nicht unter der GPL und wird für Milliarden verkauft. ;)
[patrick dahl in suse-linux]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160507/69d319b7/attachment.pgp>

More information about the AppArmor mailing list