bin/187083: Sort cannot be used for binary data.
Shayan Pooya
shayan at liveve.org
Wed Feb 26 14:40:02 UTC 2014
>Number: 187083
>Category: bin
>Synopsis: Sort cannot be used for binary data.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Feb 26 14:40:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Shayan Pooya
>Release: 10.0
>Organization:
Chango
>Environment:
The problem is independent of the OS version and can be reproduced on all public versions.
>Description:
Sort has an unnecessary check that prevents it from being used for binary data:
https://github.com/freebsd/freebsd/blob/master/usr.bin/sort/sort.c#L1063
Here is the mailing list discussion (not very useful):
http://freebsd.1045724.n5.nabble.com/Field-delimiter-in-sort-program-in-freebsd-td5879776.html
>How-To-Repeat:
$ sort -t $'\xff'
complains about the delimiter.
>Fix:
Just remove the bogus condition:
diff --git a/sort.c b/sort.c
index d811a86..664b214 100644
--- a/sort.c
+++ b/sort.c
@@ -1060,10 +1060,6 @@ main(int argc, char **argv)
}
sort_opts_vals.tflag = true;
sort_opts_vals.field_sep = btowc(optarg[0]);
- if (sort_opts_vals.field_sep == WEOF) {
- errno = EINVAL;
- err(2, NULL);
- }
if (!gnusort_numeric_compatibility) {
if (symbol_decimal_point == sort_opts_vals.field_sep)
symbol_decimal_point = WEOF;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list