diff options
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rwxr-xr-x | testsuite/sort.tests | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c index 9aac656fe..80b578fc2 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -357,9 +357,9 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
357 | int dx; | 357 | int dx; |
358 | char *xx, *yy; | 358 | char *xx, *yy; |
359 | 359 | ||
360 | xx = strptime(x, "%b", &thyme); | 360 | xx = strptime(skip_whitespace(x), "%b", &thyme); |
361 | dx = thyme.tm_mon; | 361 | dx = thyme.tm_mon; |
362 | yy = strptime(y, "%b", &thyme); | 362 | yy = strptime(skip_whitespace(y), "%b", &thyme); |
363 | if (!xx) | 363 | if (!xx) |
364 | retval = (!yy) ? 0 : -1; | 364 | retval = (!yy) ? 0 : -1; |
365 | else if (!yy) | 365 | else if (!yy) |
diff --git a/testsuite/sort.tests b/testsuite/sort.tests index ff33e21b4..fb2cc91bd 100755 --- a/testsuite/sort.tests +++ b/testsuite/sort.tests | |||
@@ -219,4 +219,15 @@ testing "sort -h" \ | |||
219 | 219 | ||
220 | # testing "description" "command(s)" "result" "infile" "stdin" | 220 | # testing "description" "command(s)" "result" "infile" "stdin" |
221 | 221 | ||
222 | testing "sort -k2,2M" \ | ||
223 | "sort -k2,2M input" "\ | ||
224 | 3 March | ||
225 | 2 April | ||
226 | 1 May | ||
227 | " "\ | ||
228 | 2 April | ||
229 | 1 May | ||
230 | 3 March | ||
231 | " "" | ||
232 | |||
222 | exit $FAILCOUNT | 233 | exit $FAILCOUNT |