[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: textutils-2.1: sort bug
From: |
Bob Proulx |
Subject: |
Re: textutils-2.1: sort bug |
Date: |
Mon, 2 Sep 2002 15:23:57 -0600 |
User-agent: |
Mutt/1.4i |
Randall Hopper <address@hidden> [2002-08-31 14:57:05 -0400]:
> |if LC_COLLATE is telling sort to sort differently then then it _must_
> |comply.
> |
> |Actually sort just passes the problem off to the C library. The C
> |library routine strcoll() does all of the work. It is useful to read
>
> True, I see what you're saying. If we presume that strcoll can fulfill the
> interface requirements advertised by the sort man page, then this follows.
Doesn't it?
> But the problem is that it doesn't. Sort's interface implies ignore-case
> and dictionary-order are not the default, yet they show up to be with
> appropriate setting of environment variables.
But as soon as you say "with appropriate setting of environment
variables" you are leaving the default behind. The default case means
that you are NOT setting environment variables.
As soon as you say LC_COLLATE=en_US are are forcing non-default
behavior.
> Perhaps an --ignore-locale option might be helpful, so that GNU sort's
> options actually mean something, and it can be made to work like other UNIX
> sorts.
That option already exists. In your case your 'locale' output tells
me it is this.
unset LC_COLLATE
Or
export LC_COLLATE=POSIX
> |In which case it is not a bug in sort but behavior which is specifically
> |required.
>
> Right, but this is derived requirement imposed only by sort's self-imposed
> requirement to use strcoll.
Negative. It is not self imposed. The sort command is _required_ to
sort that way. Many non-american-english speakers rely upon that
behavior. Removing it would graciously break these users. Also,
since it is your environment which is forcing behavior you say you
don't want then the right place to fix it is in your environment. You
have complete control over this behavior.
This has been standardized as well. Please read the online standards
documentation.
http://www.unix-systems.org/single_unix_specification_v2/xcu/sort.html
Also, you seemed to imply that your vendor set that variable for you
automatically and without your knowledge. And that since it did that
then sort should behave differently. That again is incorrect. Most
people would consider that a bug with the vendor for doing the wrong
thing and not a bug with sort for doing the right thing. It sounds to
me like what you want is in conflict with what your vendor thinks you
want. Therefore you need to change the configuration that your vendor
set up for you to be something more to your liking.
Remember that sort is just a program and it only does exactly what you
tell it to do. It can't read your mind and do what you want it to do.
Therefore you must tell it to do what you want it to do. If you or
your vendor tells it to do something with LC_COLLATE=en_US then it
will happily do that. If you don't want that behavior then you must
change the LANG and LC_* variables to do what you want it to do.
Hope this discussion helps.
Bob
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: textutils-2.1: sort bug,
Bob Proulx <=