Gentoo Archives: gentoo-portage-dev

From: felix@×××××××.com
To: gentoo-portage-dev@g.o
Subject: [gentoo-portage-dev] Re: Perl, sort, and locale -- NEVER MIND -- SIGH
Date: Thu, 04 May 2006 22:08:12
Message-Id: 20060504220740.GA18745@crowfix.com
In Reply to: [gentoo-portage-dev] Re: Perl, sort, and locale -- NEVER MIND by felix@crowfix.com
1 On Thu, May 04, 2006 at 01:23:44PM -0700, felix@×××××××.com wrote:
2 > On Wed, May 03, 2006 at 05:12:09PM -0700, felix@×××××××.com wrote:
3 >
4 > > I have discovered an inconsistency in how perl and sort handle locale.
5 > > Here are two commands you can run in a shell ...
6 > >
7 > > (echo '/'; echo '?') | sort
8 > >
9 > > (echo '/'; echo '?') | perl -e '@x = <>; print $_ foreach sort @x'
10 > >
11 > > With LANG=en_US.UTF-8, sort says ? comes before /, perl says the
12 > > opposite. Setting LC_COLLATE=C switches the sort behavior.
13 >
14 > I have now found that if you add "use locales" to the perl code, it
15 > also sorts utf difefrently.
16
17 And I have now found that even with "use locale" ("locales" is a
18 typo), perl disagrees with sort and postgres for certain values of
19 "bin" and "/bin".
20
21 The moral of the story is to not rely on perl text ordering to match
22 at least sort and postgres, and probably almost every other external
23 command.
24
25 --
26 ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
27 Felix Finch: scarecrow repairman & rocket surgeon / felix@×××××××.com
28 GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
29 I've found a solution to Fermat's Last Theorem but I see I've run out of room o
30 --
31 gentoo-portage-dev@g.o mailing list