summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-12-13 02:14:06 +0000
committerPádraig Brady <P@draigBrady.com>2015-12-14 13:40:51 +0000
commit872c0df857d322f8119c64853d042f17c1913c3a (patch)
treec81e8e0ff1b73ff1dbfc6d99da4ab706a25e7b8a /src/sort.c
parent1118f32145049cc4b949e89eda89a0ed612755de (diff)
downloadcoreutils-872c0df857d322f8119c64853d042f17c1913c3a.tar.xz
sort: fix --debug marking for -b -k1.x
We were erroneously skipping blanks in the marked comparison _after_ the key start offset was applied. * src/sort.c (debug_keys): Don't skip starting blanks if already handled by begfield(). * tests/misc/sort-debug-keys.sh: Add a test case. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/22155
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sort.c b/src/sort.c
index cf29727de..37b3b8b8f 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2274,7 +2274,8 @@ debug_key (struct line const *line, struct keyfield const *key)
if (key->eword != SIZE_MAX)
lim = limfield (line, key);
- if (key->skipsblanks || key->month || key_numeric (key))
+ if ((key->skipsblanks && key->sword == SIZE_MAX)
+ || key->month || key_numeric (key))
{
char saved = *lim;
*lim = '\0';