Bug#373704: Updated patch
Package: busybox
Version: 1:1.1.3-3
Followup-For: Bug #373704
Hi,
attached an updated patch for busybox that includes the fix for
#406785 sort: incorrect result when sorting on subfields
or does not break it if you will.
MfG
Goswin
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-frosties
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Versions of packages busybox depends on:
ii libc6 2.3.6.ds1-9 GNU C Library: Shared libraries
busybox recommends no packages.
-- no debconf information
diff -u busybox-1.1.3/coreutils/sort.c busybox-1.1.3/coreutils/sort.c
--- busybox-1.1.3/coreutils/sort.c
+++ busybox-1.1.3/coreutils/sort.c
@@ -62,7 +62,7 @@
/* Special case whole string, so we don't have to make a copy */
if(key->range[0]==1 && !key->range[1] && !key->range[2] && !key->range[3]
- && !(flags&(FLAG_b&FLAG_d&FLAG_f&FLAG_i&FLAG_bb))) return str;
+ && !(flags&(FLAG_b|FLAG_d|FLAG_f|FLAG_i|FLAG_bb))) return str;
/* Find start of key on first pass, end on second pass*/
len=strlen(str);
@@ -72,23 +72,24 @@
else {
end=0;
for(i=1;i<key->range[2*j]+j;i++) {
- /* Skip leading blanks or first separator */
- if(str[end]) {
- if(!key_separator && isspace(str[end]))
- while(isspace(str[end])) end++;
- }
- /* Skip body of key */
- for(;str[end];end++) {
+ /* Skip leading blanks */
+ if(str[end] && !key_separator)
+ while(isspace(str[end])) end++;
+ /* Skip body of key and one blank or seperator */
+ while(str[end]) {
if(key_separator) {
- if(str[end]==key_separator) break;
- } else if(isspace(str[end])) break;
+ if(str[end++]==key_separator) break;
+ } else {
+ if(isspace(str[end])) break;
+ end++;
+ }
}
}
}
if(!j) start=end;
}
- /* Key with explicit separator starts after separator */
- if(key_separator && str[start]==key_separator) start++;
+ /* Don't include the last whitespace or separator */
+ if (str[end]) end--;
/* Strip leading whitespace if necessary */
if(flags&FLAG_b) while(isspace(str[start])) start++;
/* Strip trailing whitespace if necessary */
Reply to: