From: Jim Leonard on
This has me completely stumped so whoever figures this out gets a
cookie.

On only *two* of our dozens of Solaris 9 machines, we are seeing very
odd behavior from /usr/bin/sort. Depending on the contents of the
file, the sort order will be reversed even though the contents should
not warrant such a reversing. Here's an example test file:

webix
web:x
webmx

Five characters per line, three lines. The colon is a lower ascii
number so the sort order should be with the colon first. But this
happens:

# sort /tmp/foo
webix
webmx
web:x

The entry with the colon should be first, not last...? Editing the
file to remove the trailing x, which is on every line and shouldn't
affect the sort order, somehow does:

# vi /tmp/foo
(remove trailing x)

# cat /tmp/foo
webi
web:
webm

# sort /tmp/foo
web:
webi
webm

OS revision is:
# uname -a
SunOS usilcaresap01 5.9 Generic_122300-13 sun4u sparc SUNW,Sun-Fire-
V440

What in the heck is going on??
From: Darren Dunham on
Jim Leonard <MobyGamer(a)gmail.com> wrote:
> On only *two* of our dozens of Solaris 9 machines, we are seeing very
> odd behavior from /usr/bin/sort.

Whenever you see sort oddities, think "locale".

> What in the heck is going on??

I cannot explain the ':' vs ':x' thing, but it is easily replicated.

$ LC_COLLATE=C sort /tmp/foo
web:
web:x
webi
webix
webm
webmx
$ LC_COLLATE=en_US.UTF-8 sort /tmp/foo
web:
webi
webix
webm
webmx
web:x

--
Darren Dunham ddunham(a)taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
From: Jim Leonard on
On May 6, 4:23 pm, ddun...(a)taos.com (Darren Dunham) wrote:
> Jim Leonard <MobyGa...(a)gmail.com> wrote:
> > On only *two* of our dozens of Solaris 9 machines, we are seeing very
> > odd behavior from /usr/bin/sort.
>
> Whenever you see sort oddities, think "locale".

Sure enough, that's it! Thanks for the help!
From: Jim Leonard on
On May 7, 9:37 am, Jim Leonard <MobyGa...(a)gmail.com> wrote:
> > > On only *two* of our dozens of Solaris 9 machines, we are seeing very
> > > odd behavior from /usr/bin/sort.
>
> > Whenever you see sort oddities, think "locale".
>
> Sure enough, that's it! Thanks for the help!

On further investigation, it appears as if LOCALE is not getting set
up on a few machines, which is confusing since TZ, which is also in /
etc/default/init, *is* set up. For example:

root# cat /etc/default/init
TZ=US/Central
CMASK=022
LC_COLLATE=en_US.ISO8859-1
LC_CTYPE=en_US.ISO8859-1
LC_MESSAGES=C
LC_MONETARY=en_US.ISO8859-1
LC_NUMERIC=en_US.ISO8859-1
LC_TIME=en_US.ISO8859-1
root# echo $TZ
US/Central
root# echo $LC_COLLATE

root#


What could be causing this? Are they never getting set, or are they
getting UNset by something? I thought init would set these vars on
every process spawn so why are some there and some aren't?
From: Dave Uhring on
On Wed, 07 May 2008 07:51:17 -0700, Jim Leonard wrote:

> root# echo $TZ
> US/Central
> root# echo $LC_COLLATE
>
> root#
>
>
> What could be causing this?

[duhring(a)einstein ~]$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=C