A NOTE has been added to this issue. ====================================================================== https://www.austingroupbugs.net/view.php?id=1942 ====================================================================== Reported By: dwheeler Assigned To: ajosey ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1942 Category: Shell and Utilities Type: Enhancement Request Severity: Objection Priority: normal Status: Under Review Name: David A. Wheeler Organization: User Reference: diff Section: diff Page Number: 1 Line Number: 1 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2025-08-31 22:16 UTC Last Modified: 2025-10-09 11:16 UTC ====================================================================== Summary: Add common options to diff ======================================================================
---------------------------------------------------------------------- (0007284) geoffclare (manager) - 2025-10-09 11:16 https://www.austingroupbugs.net/view.php?id=1942#c7284 ---------------------------------------------------------------------- > 3. The "-i" (Ignore Case) should refer to Refer to XPD 4.2 - general concepts (case-insensitive) (spelling?). Review the similar references to use the same format. > > Agreed. Done. I used grep as my template. You should not have used grep as the template, because diff -i does not involve regular expressions. The cross-reference should be given exactly as in https://www.austingroupbugs.net/view.php?id=1942#c7268. Comments on the proposed changes... <blockquote><pre>diff [-c|-e|-f|-u|-C n|-U n] [-abdiqsNrTw]</pre></blockquote>The last part should be alphabetical:<blockquote><pre>[-abdiNqrsTw]</pre></blockquote> <blockquote><b<-B</b> Ignore lines that are blank. A blank line is a line that is empty (contains no characters).</blockquote>This contradicts the definition of "blank line" in XBD 3.46. Please change to say "Ignore empty lines." ("Empty line" is defined in XBD 3.120.) Also, it would be better to handle the interaction with -w here rather than after the (long) list of options, for better visibility. E.g. "If the <b>-w</b> option is in effect, it is implementation-defined whether lines containing only the whitespace characters ignored by <b>-w</b> are treated as empty lines." <blockquote><b>-i</b> Compare lines in a case-insensitive manner (using LC_CTYPE)</blockquote>The requirement to use LC_CTYPE for this should be stated in the ENVIRONMENT VARIABLES section, not here. <blockquote><b>-I regexp</b> Ignore lines in both files that match the Extended Regular Expression regexp. Multiple -I options may be specified; lines matching any of the patterns shall be ignored.</blockquote>This doesn't match the GNU and FreeBSD man pages for -I. GNU says "ignore changes where all lines match RE"; FreeBSD says (in part) "All lines in the change must match some pattern for the change to be ignored." This aspect of the behaviour needs to be specified. <blockquote>Perform pattern matching in a case-insensitive manner; see XBD 9.2 Regular Expression General Requirements.</blockquote>I assume that's a typo and you meant case-sensitive. Also, since this is not the first sentence it should not be in imperative form, and I think it's worth emphasising that <b>-i</b> has no effect on this. So I'd suggest:<blockquote>Pattern matching shall be performed in a case-sensitive manner, even if the <b>-i</b> option is in effect; see [xref to XBD 9.2 Regular Expression General Requirements].</blockquote> <blockquote><b>-N</b> If file1 or file2 is a directory and the other is not, or if one file is missing during directory comparison, treat the missing file as an empty file.</blockquote>This contradicts the last paragraph of OPERANDS: "If only one of file1 and file2 is a directory, diff shall be applied to the non-directory file and the file contained in the directory file with a filename that is the same as the last component of the non-directory file." I suggest just keeping it simple:<blockquote><b>-N</b> Treat non-existent files as empty files.</blockquote> <blockquote><b>-T</b> Write a tab instead of a space before the line information about differences (to make tab alignment consistent).</blockquote>Since this is quite vague, I'd suggest adding "See the STDOUT section for details." <blockquote><b>-w</b> [...]</blockquote>This should be worded in a manner consistent with the description of <b>-b</b>. It's possible <b>-b</b> needs tweaking as well, in particular do implementations treat strings of <i>any</i> white-space characters (except newline) as equivalent, or only those in the portable character set? It seems unlikely there would be inconsistency between -b and -w on this for an implementation. <blockquote><b>-x pattern</b> [...] shell pattern [...]</blockquote>Please re-word using the description of find -name as a guide for how to specify the pattern matching. Likewise for -X. <blockquote>Multiple -x options may be specified.</blockquote>Change "may" to "can". <blockquote>a diagnostic line is written to standard output</blockquote>Although not a strict rule, the standard tends only to use "diagnostic" for messages written to standard error. Just "a line" would work fine here. Also this and other uses of present tense in the STDOUT additions should change to use "shall". Issue History Date Modified Username Field Change ====================================================================== 2025-08-31 22:16 dwheeler New Issue 2025-08-31 22:16 dwheeler Status New => Under Review 2025-08-31 22:16 dwheeler Assigned To => ajosey 2025-09-01 15:08 dwheeler Note Added: 0007248 2025-09-11 15:50 geoffclare Project 1003.1(2008)/Issue 7 => 1003.1(2024)/Issue8 2025-09-12 14:43 dwheeler Note Added: 0007257 2025-09-12 14:44 dwheeler Note Edited: 0007257 2025-09-12 14:45 dwheeler Note Edited: 0007257 2025-09-18 16:00 geoffclare Note Added: 0007268 2025-09-18 16:01 geoffclare Note Edited: 0007268 2025-10-05 00:19 dwheeler Note Added: 0007283 2025-10-09 11:16 geoffclare Note Added: 0007284 ======================================================================
