svn commit: trunk/busybox: coreutils testsuite
landley at busybox.net
landley at busybox.net
Thu Jun 15 20:50:40 UTC 2006
Author: landley
Date: 2006-06-15 13:50:38 -0700 (Thu, 15 Jun 2006)
New Revision: 15397
Log:
Fix bug found by Joey Hess and forwarded by Bastian Bunk. Add Joey Hess's
test case to the testsuite, plus another one that would have been broken by
the first attempt at a fix.
Modified:
trunk/busybox/coreutils/sort.c
trunk/busybox/testsuite/sort.tests
Changeset:
Modified: trunk/busybox/coreutils/sort.c
===================================================================
--- trunk/busybox/coreutils/sort.c 2006-06-15 20:07:57 UTC (rev 15396)
+++ trunk/busybox/coreutils/sort.c 2006-06-15 20:50:38 UTC (rev 15397)
@@ -74,9 +74,7 @@
for(i=1;i<key->range[2*j]+j;i++) {
/* Skip leading blanks or first separator */
if(str[end]) {
- if(key_separator) {
- if(str[end]==key_separator) end++;
- } else if(isspace(str[end]))
+ if(!key_separator && isspace(str[end]))
while(isspace(str[end])) end++;
}
/* Skip body of key */
Modified: trunk/busybox/testsuite/sort.tests
===================================================================
--- trunk/busybox/testsuite/sort.tests 2006-06-15 20:07:57 UTC (rev 15396)
+++ trunk/busybox/testsuite/sort.tests 2006-06-15 20:50:38 UTC (rev 15397)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# SUSv3 compliant sort tests.
# Copyright 2005 by Rob Landley <rob at landley.net>
@@ -66,4 +66,18 @@
egg 1 2 papyrus
" "$data" ""
+testing "sort key doesn't strip leading blanks, disables fallback global sort" \
+"sort -n -k2 -t ' '" " a \n 1 \n 2 \n" "" " 2 \n 1 \n a \n"
+
+testing "sort key edge case with -t" "sort -n -k4 -t/" \
+"/usr/lib/finish-install.d/1
+/usr/lib/finish-install.d/4
+/usr/lib/prebaseconfig.d/2
+/usr/lib/prebaseconfig.d/6
+" "" "/usr/lib/finish-install.d/1
+/usr/lib/prebaseconfig.d/2
+/usr/lib/finish-install.d/4
+/usr/lib/prebaseconfig.d/6
+"
+
exit $FAILCOUNT
More information about the busybox-cvs
mailing list