<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>34</bug_id>
          
          <creation_ts>2007-10-24 14:26:59 +0000</creation_ts>
          <short_desc>String collation failing</short_desc>
          <delta_ts>2010-12-21 06:07:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Matt Hoosier">matt.hoosier</reporter>
          <assigned_to name="Dongxiao Xu">dongxiao.xu</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2022</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-10-24 14:26:59 +0000</bug_when>
    <thetext>The glibc built-in mechanism for doing locale-dependent string sorting seems to
be malfunctioning with glibc 2.5 as present in Blinky.

The following test program should report -1 as the result of calling wcscoll(),
but it rather thinks that they&apos;re equal.

#include &lt;wchar.h&gt;
#include &lt;locale.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

#define A &quot;A&quot;
#define B &quot;B&quot;
#define WCS_A L&quot;A&quot;
#define WCS_B L&quot;B&quot;

int
main ()
{
    const wchar_t * a = WCS_A;
    const wchar_t * b = WCS_B;

    setenv (&quot;LC_ALL&quot;, &quot;en_GB.utf8&quot;, 1);
    setlocale (LC_ALL, &quot;&quot;);

    printf (&quot;wcscoll(\&quot;%s\&quot;, \&quot;%s\&quot;): %d\n&quot;, A, B, wcscoll (a, b));
    return 0;
}

I think this might be something particular to glibc-2.5, because I&apos;ve used this
test successfully on glibc-2.3 from an external CSL toolchain, and also
successfully on my Gutsy desktop running glibc-2.6.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2024</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-10-24 14:53:19 +0000</bug_when>
    <thetext>Some quick tests here show two devices with current poky images give -1 as the
result so I can&apos;t seem to reproduce the problem. I don&apos;t think glibc has changed
since blinky. Were you using the standard toolchain or an external one?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2025</commentid>
    <comment_count>2</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-10-24 15:11:13 +0000</bug_when>
    <thetext>Standard poky toolchain. I don&apos;t think it makes any difference, because I unset
all my LANG-related environment variables on my desktop to rule it out, but just
in case: do you have anything like $LANG or $LC_ALL set on your device&apos;s
environments?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-10-26 12:44:21 +0000</bug_when>
    <thetext>I just checked and nothing language related is set...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2031</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-10-26 13:23:34 +0000</bug_when>
    <thetext>Something I noticed which may or may not be related is that on my Ubuntu system,
 ls /usr/lib/locale/en_GB gives &quot;en_GB/ en_GB.utf8/&quot; in poky based images we
have &quot;en_GB/ en_GB.iso8859/&quot; (assuming the en_GB.iso8859 package is installed)
with I think en_GB being the utf8 version.

Just to try and make sure we&apos;re comparing the same systems, you have binary
locale generation enabled? Which locales are installed?

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2468</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-12-18 15:26:00 +0000</bug_when>
    <thetext>Matt, did you resolve this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2473</commentid>
    <comment_count>6</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-18 20:11:56 +0000</bug_when>
    <thetext>No, in fact I just had this crop up as the cause for another symptom lately.

Regarding your question about my setup and set of installed locales:

* I&apos;ve tried both with and without binary locale generation; same result.

* I install with a whole gaggle of locales; en_GB is among them.

* When using binary locales, I have the following choices in /usr/lib/locale for UK English:

  /usr/lib/locale/en_GB

  I know this looks like an easy culprit since the source snippet uses &quot;en_GB.utf8&quot;, but other locale-dependent things seem to work okay. And if I change the failing example to use &quot;en_GB&quot;, things still fail.

* When using nonbinary locales, it&apos;s harder to tell for sure what locales survived on the device since they&apos;re all stuff away in /usr/lib/locale/locale-archive. I assume they&apos;re the same?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2474</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-12-18 20:17:59 +0000</bug_when>
    <thetext>Are you using prelink?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2476</commentid>
    <comment_count>8</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-18 20:32:39 +0000</bug_when>
    <thetext>I currently use prelink, though I&apos;ve tested and got the failure on images explicitly built to leave that out.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2477</commentid>
    <comment_count>9</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-18 20:33:47 +0000</bug_when>
    <thetext>I&apos;m going to test this on a plain old poky-image-sato and see what happens. Perhaps there&apos;s some unintended clobbering in my company&apos;s proprietary software stack.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2478</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-12-18 20:37:32 +0000</bug_when>
    <thetext>I was just thinking that poky trunk has some bugfixes to the prelink arm_eabi patch and that the old version could in theory see problems like that bad test result. If you can test a standard poky-image-sato that would be good, I have tested and couldn&apos;t reproduce in that...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2479</commentid>
    <comment_count>11</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-18 20:58:14 +0000</bug_when>
    <thetext>poky-image-sato still gives the me same result. I don&apos;t think we really have anything too invasive redefined for our machine setup; only usual stuff like selecting the serial console, naming the rootfs device, etc.

I wonder whether you ever happened to try this with the include/tune-xscale.conf machine type. It&apos;s a longshot, but perhaps buggy code is being emitted for the locale module?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2480</commentid>
    <comment_count>12</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2007-12-18 21:31:33 +0000</bug_when>
    <thetext>richard@max:/tmp$ /usr/local/poky/eabi-glibc/arm/bin/arm-poky-linux-gnueabi-gcc test.c -o test
richard@max:/tmp$ scp test root@192.168.1.37:/
richard@max:/tmp$ ssh root@192.168.1.37
root@spitz:~# /test
wcscoll(&quot;A&quot;, &quot;B&quot;): -1

spitz uses include/tune-xscale.conf

The only difference I can see is that this is with poky trunk rather than blinky but I can&apos;t think of any changes that would affect this...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2481</commentid>
    <comment_count>13</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-18 22:53:45 +0000</bug_when>
    <thetext>Hmm, I just completely fresh build of poky-image-sato with the inclusion of tune-xscale.conf commented out.

The collation routines work in this configuration. I&apos;m going to try to see whether this is related to the code in libc-2.5.so or the data payload of the locales, and post back.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2482</commentid>
    <comment_count>14</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-19 03:54:58 +0000</bug_when>
    <thetext>It turns out that I didn&apos;t control all the variables in my test for building with(out) xscale tuning. DEBUG_BUILD is the real culprit for me.

Seems that localedef, when built with debugging info and fewer optimizations, emits locale data that&apos;s broken somehow. I can take a system built with DEBUG_BUILD=1 and overwrite /usr/lib/locale/locale-archive with a copy generated on a system using DEBUG_BUILD=0, and the string collation is repaired.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2485</commentid>
    <comment_count>15</comment_count>
    <who name="Matt Hoosier">matt.hoosier</who>
    <bug_when>2007-12-20 00:03:06 +0000</bug_when>
    <thetext>The bug&apos;s (still don&apos;t know precisely what) in ld-collate.c.

If you recompile just that one file using ${FULL_OPTIMIZATION} rather than ${DEBUG_OPTIMIZATION}, the collation tables generated are usable again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9408</commentid>
    <comment_count>16</comment_count>
    <who name="Dongxiao Xu">dongxiao.xu</who>
    <bug_when>2010-08-25 22:27:14 +0000</bug_when>
    <thetext>Test the program on netbook with glibc-2.10.1, the result returns -1 correctly. I think we can close this bug, Saul?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9520</commentid>
    <comment_count>17</comment_count>
    <who name="Dongxiao Xu">dongxiao.xu</who>
    <bug_when>2010-09-01 19:04:18 +0000</bug_when>
    <thetext>Marked it as WORKSFORME since it could not be reproduced on my side.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>