public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cgd at google dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/11394] New: locale-archive differs between x86_64-linux and i686-linux due to unintentional hash difference
Date: Wed, 17 Mar 2010 06:30:00 -0000	[thread overview]
Message-ID: <20100317063043.11394.cgd@google.com> (raw)

locale-archive files generated on x86_64-linux and i686-linux differ
unnecessarily, due a likely-unintentional hash difference.

they're compatible with each other AFAICT, but they aren't identical when built
fresh (and they easily could be).

to repro:
configure / build glibc for i686-linux and x86_64-linux.
in each, install locale data & create a locale-archive file by doing:
  make localedata/install-locales 'SUPPORTED-LOCALES=en_US/ISO-8859-1
en_US.UTF-8/UTF-8'

compare the locale-archive files.  They're much the same, but the
_NL_CTYPE_WIDTH tables are different.  in particular, some of the early
(high-level) 3level table entries have different order, and thus later data in
the file also differs.  However, each is usable/correct.

the wcwidth_table 3level table is constructed by iterating charmap->char_table
(a simple-hash).

the iteration order depends order of entries in the table, which depends on the
compute_hashval hash function (whose result is modded by the table size).

the version of compute_hashval used for simple-hash returns unsigned long int,
and the computed hash value differs between i686 and x86_64, so the 3level table
gets populated in a different order, ...

the hash table in this case doesn't make it to disk, so it's safe to tweak the
return type.  (the hashes that use compute_hashval and *do* make it to disk use
uint32_t already.)

while it's not strictly necessary to fix this, it's comforting to see identical
results when building on 32-bit and 64-bit.  will attach patch.

-- 
           Summary: locale-archive differs between x86_64-linux and i686-
                    linux due to unintentional hash difference
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: cgd at google dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-linux
  GCC host triplet: x86_64-linux
GCC target triplet: x86_64-linux and i686-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=11394

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2010-03-17  6:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17  6:30 cgd at google dot com [this message]
2010-03-17  6:36 ` [Bug libc/11394] " cgd at google dot com
2010-03-25  0:11 ` drepper at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100317063043.11394.cgd@google.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).