Bug 210377

Summary: usr.bin/comm update manpage
Product: Documentation Reporter: Tobias Berner <tcberner>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed Works As Intended    
Severity: Affects Only Me CC: ws
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Be more precise in the manpage. none

Description Tobias Berner 2016-06-18 16:33:57 UTC
Created attachment 171553 [details]
Be more precise in the manpage.

The manpage of /usr/bin/comm says at the moment, that file1 and file2 "should be sorted". This gives the impression that it will work as expected if the files are not sorted, but maybe with a slight penalty on performance.

It is however the case, that unsorted files do not work as expected:


Example:
%  cat file1
line1
line3
line2

%  cat file2
line1
line2
line3

%  comm -12 file1 file2
line1
line3



The attached patch changes the language to "have to be sorted".
Comment 1 Wayne Sierke 2016-07-07 03:36:07 UTC
The POSIX man page for comm uses "should" and additionally states:

   If the lines in both files are not ordered according to the collating sequence of the current locale, the results are unspecified.


The FreeBSD man page states:

   The comm utility assumes that the files are lexically sorted; all characters participate in line comparisons.


I think it is generally well-understood that in this context "should" indicates a requirement of conformance. The additional statement reinforces that requirement. There is no need to replace "should".
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-23 19:43:00 UTC
Agreed

Even something like
-which should be
+which must be

is still ambiguous as to what happens if lines are unsorted. Additionally, we do mention that comm(1) assumes lines are sorted.

Appreciate the contribution but I'm going to close this.