Bug 1311954

Summary: glibc: Binary locale files vary within a mutilib set e.g. x86_64/i686 and should not.
Product: [Fedora] Fedora Reporter: Mike FABIAN <mfabian>
Component: glibcAssignee: DJ Delorie <dj>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: arjun.is, codonell, dj, fweimer, jakub, law, mfabian, pfrankli, siddhesh
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-30 13:28:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike FABIAN 2016-02-25 11:41:07 UTC
The binary locale files of glibc should be architecture independent,
but they are not.

Carlos O’Donell: “... the fact that they don't match means there is an upstream ABI bug.”

To test whether they match or not, I did this:

I built glibc from the current f23 branch here:

http://koji.fedoraproject.org/koji/taskinfo?taskID=13113924

Then downloaded:

https://kojipkgs.fedoraproject.org//work/tasks/3923/13113923/glibc-common-2.22-10.fc23.x86_64.rpm
https://kojipkgs.fedoraproject.org//work/tasks/3924/13113924/glibc-common-2.22-10.fc23.i686.rpm

unpacked the rpms and checked whether locale-archive.tmpl differ.

They do differ:

mfabian@ari:~/tmp/glibc-locale-subpackaging
$ diff {i686,x86_64}/usr/lib/locale/locale-archive.tmpl
Binary files i686/usr/lib/locale/locale-archive.tmpl and
x86_64/usr/lib/locale/locale-archive.tmpl differ
mfabian@ari:~/tmp/glibc-locale-subpackaging
$

And not only a little bit:
mfabian@ari:~/tmp/glibc-locale-subpackaging
$ cmp -l {i686,x86_64}/usr/lib/locale/locale-archive.tmpl |wc
3084277 9252831 55516986
mfabian@ari:~/tmp/glibc-locale-subpackaging
$

Comment 1 Carlos O'Donell 2016-02-25 14:42:01 UTC
With the new langpack split up you can see exactly which locales have problems:

file /usr/lib/locale/hu_HU/LC_COLLATE from install of glibc-langpack-hu-2.22.90-52.fc24.i686 conflicts with file from package glibc-langpack-hu-2.22.90-52.fc24.x86_64

file /usr/lib/locale/om_ET/LC_COLLATE from install of glibc-langpack-om-2.22.90-52.fc24.i686 conflicts with file from package glibc-langpack-om-2.22.90-52.fc24.x86_64
file /usr/lib/locale/om_KE.utf8/LC_COLLATE from install of glibc-langpack-om-2.22.90-52.fc24.i686 conflicts with file from package glibc-langpack-om-2.22.90-52.fc24.x86_64

file /usr/lib/locale/th_TH.utf8/LC_COLLATE from install of glibc-langpack-th-2.22.90-52.fc24.i686 conflicts with file from package glibc-langpack-th-2.22.90-52.fc24.x86_64
file /usr/lib/locale/th_TH/LC_COLLATE from install of glibc-langpack-th-2.22.90-52.fc24.i686 conflicts with file from package glibc-langpack-th-2.22.90-52.fc24.x86_64

So hu_HU, om_ET, om_KE.utf8, th_TH, th_TH.utf8 all have differences.

Comment 2 Jan Kurik 2016-07-26 04:08:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 3 Fedora End Of Life 2017-02-28 09:54:34 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 4 Fedora End Of Life 2018-05-03 08:43:30 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. 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 EOL if it remains open with a Fedora  'version'
of '26'.

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.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 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, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

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.

Comment 5 Fedora End Of Life 2018-05-29 11:55:04 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Jan Kurik 2018-08-14 10:22:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 9 Florian Weimer 2019-03-07 21:22:17 UTC
The locale files are not architecture-independent because they use host endianess.  (The data is mapped directly into the process.)

I think the actual problem is that the locale data was not reproducible, which means that the locale files are not multiarch-clean from an RPM perspective.  It is worth examining if after the change in bug 1652228, this problem is gone and the file contents is now fully reproducible.

Comment 10 Carlos O'Donell 2019-03-08 01:47:34 UTC
(In reply to Florian Weimer from comment #9)
> The locale files are not architecture-independent because they use host
> endianess.  (The data is mapped directly into the process.)

That is OK.

> I think the actual problem is that the locale data was not reproducible,
> which means that the locale files are not multiarch-clean from an RPM
> perspective.  It is worth examining if after the change in bug 1652228, this
> problem is gone and the file contents is now fully reproducible.

Correct, we're talking about multiarch-clean e.g. s390x vs s390, or i686 vs x86_64.

There are 2 issues at hand and I confused them.

(a) Differences in files due to hard linking.

(b) Differences in locale-archive.tmpl between rpm multilibs e.g. i686 vs x86_64.

I think that bug 1652228 fixes (a), and is what I saw in comment #1, namely that the hardlink setup makes them non-multiarch-clean.

However, it leaves (b), which is the real issue Mike commented on in the bug description.

The glibc-all-langpacks for i686 and x86_64 should have an identical template (copy of the locale archive) unless we have indeterminate sorting somewhere putting the files in the wrong order into the archive?

Comment 12 DJ Delorie 2019-03-21 00:26:48 UTC
I did some research on this bug, and it turns out to be a rounding difference in floating point math choices between the architectures.  I've posted an analysis and possible fix upstream:

https://www.sourceware.org/ml/libc-alpha/2019-03/msg00424.html

Comment 13 Carlos O'Donell 2019-10-30 13:28:35 UTC
This is fixed upstream with this:

commit ac64195ccd4f320659fd0058bc7524c6fd0b37b4
Author: DJ Delorie <dj>
Date:   Wed Mar 20 23:56:59 2019 -0400

    iconv, localedef: avoid floating point rounding differences [BZ #24372]
    
    Two cases of "int * 1.4" may result in imprecise results, which
    in at least one case resulted in i686 and x86-64 producing
    different locale files.  This replaced that floating point multiply
    with integer operations.  While the hash table margin is increased
    from 40% to 50%, testing shows only 2% increase in overall size
    of the locale archive.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1311954
    
    Reviewed-by: Carlos O'Donell <carlos>

The hardlink issue is fixed here in the spec file:

commit fdcac6f8f4b2f3d0d1cca6974ef7a8997a2997ad
Author: Florian Weimer <fweimer>
Date:   Mon Nov 26 14:58:44 2018 +0100

    Do not use parallel make for building locales (#1652228)

It is also fixed in Rawhide and F31.

Closing as fixed.