Subject: bug#23665: spaces in keys: doc, --debug in LC_ALL=C

From: Assaf Gordon <[email-masked]>
Date: Tue, 31 May 2016 20:38:11 -0400

Hello Karl and all,

> On May 31, 2016, at 19:15, Karl Berry <[email-masked]> wrote:
[...]
> I'm not sure what you mean by [...].  The %lu?
> Are you proposing to just add the word "sort"?  That's not needed IMHO.

I was suggesting exactly that :)
Also, the word "key" appears in few other messages, the attached patch adds "sort" to them all. This is of course just a suggestion, and we can use another syntax like the one you listed.

Attached are 3 patches, not finalized but good as a starting point for comments.

1. rephrase "key" with "sort key". Perhaps this is superfluous - thoughts ?

2. add a bit more verbose progress information to the 'sort-debug-warn.sh' test - just so it'll be easier to discuss to the changed messages.

3. removes the 'maybe_space_aligned' and modifies the condition a bit.

Expanding on the third patch:
In the following two tests, the "leading space" warning is now printed (the numbers refer to the numbers added in patch 2):
   #7 
   sort -gbr -k1,1n -k1,1r --debug /dev/null
   #11
   sort -k1,1r --debug /dev/null

I would say this is correct, as spaces do matter for LC_ALL=C with "-r" sorting:

    $ cat -A 1.txt 
    x  A$
    x   B$
    x C$

    $ LC_ALL=C ./src/sort -k2,2r 1.txt 
    x C
    x  A
    x   B

    $ LC_ALL=C ./src/sort -k2b,2r 1.txt 
    x C
    x   B
    x  A

The "leading space" warning is removed from the last test, because for keys that are "zero widths" and are ignored there's no point in printing the warning.

Comments welcomed,
  - assaf