PƔdraig Brady <P <at> draigBrady.com> writes:
> > Nice thought. But it would violate POSIX if done by default
>
> POSIX says you can't warn users about potential problems?
One person's bug is another person's feature. The entire reason that
LC_COLLATE exists is because some people INTENTIONALLY want to sort files in
other than the C locale order, when they know what they are doing. POSIX
pretty much states that if an application prints a message to stderr, it should
exit with non-zero status, unless explicitly mentioned otherwise in the POSIX
requirements for that application. And since sort doesn't know whether the
user meant to use that LC_COLLATE setting, it would have to exit with 0 status,
in spite of any warnings, for the case of the user that meant that sort order.
Hence, there is no way to print a warning, be successful, and still comply with
POSIX all at the same time. True, we could key off of POSIXLY_CORRECT, but I'd
rather minimize the (ab)use of that environment variable.
--
Eric Blake