diff options
author | wxj <wangxiaojianffgz@163.com> | 2016-12-25 15:58:10 +0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-12-25 21:18:19 -0600 |
commit | 7a7378629cc3d67b27c64452391b80aa8a5a6481 (patch) | |
tree | 52e9ab10ae6357a24a9c970005809e410fc13151 /toys/posix/cp.c | |
parent | 4582497e8839d7a3d73aa71f76c2aae915202d41 (diff) | |
download | toybox-7a7378629cc3d67b27c64452391b80aa8a5a6481.tar.gz |
Fix a bug for sort. When the key_separator is not space, the sort commandline tool fails to sort by the 3rd,4th,etc column. For example: when you exec
$ sort -t',' -k 3n
on a file which cotains:
1,2,3,4
2,3,4,1
4,1,2,3
3,4,1,2
you got:
4,1,2,3
1,2,3,4
2,3,4,1
3,4,1,2
but the expected output should be:
3,4,1,2
4,1,2,3
1,2,3,4
2,3,4,1
The bug is due to the dependency of "isspace(str[end])" at line 113.
When searching for the non-space key_separator, the search stopped just at the position of first key_separator it met.
The bug can be easily fixed by adding "end++" when the search have found one separator and exit the for loop.
Diffstat (limited to 'toys/posix/cp.c')
0 files changed, 0 insertions, 0 deletions