View Issue Details

IDProjectCategoryView StatusLast Update
00014981003.1(2016/18)/Issue7+TC2Shell and Utilitiespublic2024-06-11 09:07
Reportergeoffclare Assigned To 
PrioritynormalSeverityObjectionTypeClarification Requested
Status ClosedResolutionAccepted 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Sectiondiff
Page Number2663
Line Number86756
Interp Status---
Final Accepted Text
Summary0001498: diff exit status when an error occurs while writing the differences
DescriptionThe EXIT STATUS section for diff includes:
1 Differences were found.

>1 An error occurred.
If differences are found but an error occurs when the differences are being written to standard output, then both of these descriptions are true, and the standard does not specify a precedence between them, which means that at first sight conforming implementations can exit with status 1 or >1.

When the rules from 1.4 Utility Description Defaults are brought into play, it is apparent that the exit status has to be >1, but it would be better if it was easily seen from just the diff EXIT STATUS section rather than having to follow this chain of reasoning:
1.4 under CONSEQUENCES OF ERRORS says "A diagnostic message shall be written to standard error whenever an error condition occurs."

diff STDERR says "The standard error shall be used only for diagnostic messages."

1.4 under STDERR says "When this section is listed as ``The standard error shall be used only for diagnostic messages.'', it means that, unless otherwise stated, the diagnostic messages shall be sent to the standard error only when the exit status indicates that an error occurred and the utility is used as described by this volume of POSIX.1-2017.

Therefore if an error occurs when writing the differences a diagnostic message has to be written, and because a diagnostic message was written the exit status has to be one that indicates an error occurred (if the utility is used as described...).

Desired ActionChange:
Differences were found.
to:
Differences were found and all differences were successfully output.

Tagstc3-2008

Relationships

related to 0001499 Closed Use of "non-zero" in 1.4 under CONSEQUENCES OF ERRORS is not specific enough 
related to 0001500 Closed expr EXIT STATUS needs some changes 
related to 0001501 Closed find EXIT STATUS needs some changes 
related to 0001502 Closed Exit status 0 for the grep utility needs changing 
related to 0001508 Closed Exit status 0 for the stty utility needs changing 
related to 0001509 Closed tty EXIT STATUS needs some changes 
related to 0001512 Closed Exit status 0 for the what utility needs changing 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-08-06 11:14 geoffclare New Issue
2021-08-06 11:14 geoffclare Name => Geoff Clare
2021-08-06 11:14 geoffclare Organization => The Open Group
2021-08-06 11:14 geoffclare Section => diff
2021-08-06 11:14 geoffclare Page Number => 2663
2021-08-06 11:14 geoffclare Line Number => 86756
2021-08-06 11:14 geoffclare Interp Status => ---
2021-08-06 11:17 geoffclare Relationship added related to 0001499
2021-08-06 13:01 geoffclare Relationship added related to 0001500
2021-08-06 14:41 geoffclare Relationship added related to 0001501
2021-08-06 15:11 geoffclare Relationship added related to 0001502
2021-08-10 15:18 geoffclare Relationship added related to 0001508
2021-08-10 15:25 geoffclare Relationship added related to 0001509
2021-08-12 14:16 geoffclare Relationship added related to 0001512
2021-12-02 16:27 Don Cragun Status New => Resolved
2021-12-02 16:27 Don Cragun Resolution Open => Accepted
2021-12-02 16:29 Don Cragun Tag Attached: tc3-2008
2022-01-06 10:37 geoffclare Status Resolved => Applied
2024-06-11 09:07 agadmin Status Applied => Closed