SUMMARY: Funny ls sorting (Solaris 7)

From: John Horne (
Date: Tue Dec 14 1999 - 05:35:37 CST


Apologies for the slightly delayed summary - I was on an NT server admin and
security course last week. (Must say I prefer unix - but then I guess I am
biased :-))

I received quite a lot of replies to this (my original message below). Many
thanks to you all, but particularly Tim Pointing, Brian Laughton and Casper
Dik who offered lots of suggestions :-)

Okay. First of all the problem was not due to:

1) an alias for 'ls' being set, with or without any options.

2) different 'ls' commands being run. They both ran out of /usr/bin.

It *was*, however, a locale problem. As some of you spotted I am in the UK
and, yes, we set the local to 'en_GB' on some systems; more recent ones have
'en_GB.ISO8859-15'. The problem existed for all the systems.

Using 'truss' showed that locale subroutines were being called in one case
but not in the 'su -' instance. I initially accepted this with no more said.
However, my thought was that 'su -' was supposed to be the same as the user
logging in, and, therefore, they receive the same environment variables.
Obviously this wasn't happening. (BTW many thanks to however it was for
pointing out the 'locale' command.)

Reading the 'su' man page states that 'su -' is the same as logging in and
the environment variables are copied across. Reading *further* on about the
LC* variables states that if none of the LC* variables are set then the 'C'
locale will determine the actions required (in this case the output of the
'ls' command).

Now I don't explicitly set any of the LC* variables for either account but
let the system 'default' to our locale (en_GB). However, with 'su -', since
they are not set, it goes back to using 'C' rather than 'en_GB'. Hence I see
the differing output. It could be argued that 'su -' should default to the
system default ('en_GB' in our case) rather than 'C'. I don't know, what do
others think? Should I take this further with Sun?

Many thanks again,


On 03-Dec-99 at 13:21:28 John Horne wrote:
> I have noticed an odd problem (?) with the 'ls' command under Solaris 7. I
> login to an account and type 'ls -l' - it shows 4 entries:
> drwxr-xr-x 2 user1 user 512 Dec 2 16:22 bin
> drwxr-xr-x 2 user1 user 512 Dec 2 16:22 data
> -rw-r--r-- 1 user1 user 0 Dec 3 13:06 errors
> -rw-r--r-- 1 user1 user 0 Dec 3 13:06 SHORT.done
> If I logout and login as another user, and then type 'su - user1' and run
> 'ls -l' I get:
> -rw-r--r-- 1 user1 user 0 Dec 3 13:06 SHORT.done
> drwxr-xr-x 2 user1 user 512 Dec 2 16:22 bin
> drwxr-xr-x 2 user1 user 512 Dec 2 16:22 data
> -rw-r--r-- 1 user1 user 0 Dec 3 13:06 errors
> Surely the ls command should be the same for both? The system is Solaris 7
> with MU2 (5/98) and all recommended patches. Both accounts use the Korn
> shell (just in case it was a shell thing).

John Horne, University of Plymouth, UK Tel: +44 (0)1752 233914
Finger for PGP key:

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:35 CDT