> echo "fdp.txtUNE/ser/redaeR/daerorca/bil/rsu\nf.dpu" | sort -s
fdp.txtUNE/ser/redaeR/daerorca/bil/rsu
f.dpu
Since "." is not a field separating character by default, the first 3 characters appear to say:
f <= f (that's fine)
d <= . (in ASCII, "." < "d", but I'm OK with sort deciding letters come before punctuation)
p <= d (this is problematic)
Even worse, if I remove one letter from the second string, the results are reversed:
> echo "fdp.txtUNE/ser/redaeR/daerorca/bil/rsu\nf.dp" | sort -s
f.dp
fdp.txtUNE/ser/redaeR/daerorca/bil/rsu
What hideousness is going on here and how do I stop it? I thought "-s" would suffice, but apparently not.
From what I can tell, 'sort' thinks "f.dpu" > "fdp.t" because "u" > "t". However, that comparison should never be made, since characters before it already differ.
As a note, I get the same results without the "-s".
EDIT: setting environment variable LC_ALL to "C" fixes this, but it still bugs me that leaving LC_ALL (locale) blank yields inconsistent results (different is OK, inconsitent is bad).