bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #11004] Results of "sort" fail "sort -c" check if LANG is set and m


From: Paul Eggert
Subject: [bug #11004] Results of "sort" fail "sort -c" check if LANG is set and memory is low
Date: Wed, 04 Oct 2006 17:28:29 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20060902 Firefox/1.0.4 (Debian package 1.0.4-2sarge11)

Update of bug #11004 (project coreutils):

             Open/Closed:                  Closed => Open                   

    _______________________________________________________

Follow-up Comment #6:

I looked at the bug again, and now I think I understand it
better.  You're calling "sort" twice, in two different
environments.  In one environment "sort' has an artificially
restricted amount of memory, so that the call to "setlocale"
fails, and "sort" behaves as if LC_ALL is equal to C.  In
the other, there is no such restriction and "sort" behaves
as if LC_ALL is equal to en_GB.ISO-8859-15.  The two locales
are not consistent, so "sort" sorts differently under them.

You suggested 'if sort is unable to produce an output that
would pass a "sort -c" check, I think it should exit with a
nonzero status (probably 2).'  But if you invoke "sort -c"
in the same environment as "sort", it will pass the "sort
-c" check.  So I don't think this is a serious bug.

One possible fix would be for "sort" to report an error
message if setlocale fails.  However, this would have
negative consequences.  I've been on systems that behave
that way, and whenever you set the locale to something
"wrong", you start getting diagnostics from nearly every
program that you run.  The normal Unix utility tradition is
therefore to ignore setlocale failures, and silently fall
back on the POSIX locale.

A better fix might be to modify glibc setlocale to set errno
reliably (currently it doesn't), and to report an error if
we are using glibc and if the errno value indicates a memory
problem.  This will require a change to glibc.  Perhaps you
could tackle that task?


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?11004>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]