Bug 261495

Summary: sort --debug should print the information to stderr instead stdout
Product: Base System Reporter: Wolfram Schneider <wosch>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People CC: emaste, grahamperrin
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Wolfram Schneider freebsd_committer freebsd_triage 2022-01-26 17:22:58 UTC
sort --debug should print the information to stderr instead stdout

BSD sort has a flag to display extract information (memory usage, collate, sort method).

     --debug
             Print some extra information about the sorting process to the
             standard output.

e.g.:

$ cat /dev/null  | sort --debug
Memory to be used for sorting: 34288343040
Using collate rules of C.UTF-8 locale
sort_method=heapsort

I do not like that the debug information is printed to the same file descriptor (stdout) as the normal output.

$ date  | sort | wc -l
       1

$ date  | sort --debug | wc -l
       4

Proposed fix: print the debug information to stderr, similar to GNU sort.