Copyright © 2006 IEEE. All rights reserved.
Interpretation Number: 044
Topic: may fails vs shall fails
Relevant Sections: XSH accept,bind,catgets,strdup------------------------------------------------------------------------
7 Defect Report concerning (number and title of International Standard or DIS final text, if applicable):
The System Interfaces Volume of IEEE Std 1003.1-2001
------------------------------------------------------------------------
8 Qualifier (e.g. error, omission, clarification required):
1. Error
------------------------------------------------------------------------
9 References in document (e.g. page, clause, figure, and/or table numbers):
Page: 98 Line: 3735-3736 Section: accept() XSHbug2.txt Enhancement Request Number 5
Page: 152 Line: 5302 Section: bind() XSHbug2.txt Enhancement Request Number 7
Page: 174 Line: 5774-5783 Section: catgets() XSHbug2.txt Enhancement Request Number 8
Page: 1440 Line: 44857 Section: strdup() XSHbug2.txt Enhancement Request Number 4
------------------------------------------------------------------------
10 Nature of defect (complete, concise explanation of the perceived problem):
Problem:
Edition of Specification (Year): 2004
Defect code : 1. Error
The standard has a number of errors stated as may fails that should be shall fails:
The accept() function may fail if:
3734 [ENOBUFS] No buffer space is available. 3735 [ENOMEM] There was insufficient memory available to complete the operation.
These should be "shall fail" errors.
The bind() function may fail if: 5302 [ENOBUFS] Insufficient resources were available to complete the call.
This should be a "shall fail" error.
The standard says for catgets():
5890 reason, s shall be returned and errno may be set to indicate the error.
5891 ERRORS
5892 The catgets() function may fail if: 5893 [EBADF] The catd argument is not a valid message catalog descriptor open for reading. 5894 [EBADMSG] The message identified by set_id and msg_id in the specified message catalog 5895 did not satisfy implementation-defined security criteria. 5896 [EINTR] The read operation was terminated due to the receipt of a signal, and no data 5897 was transferred. 5898 [EINVAL] The message catalog identified by catd is corrupted. 5899 [ENOMSG] The message identified by set_id and msg_id is not in the message catalog.
Some of the errrors here should probably be "shall fail" (e.g. EINTR, see accept()) and the wording "errno may be set" bit (especially if some error(s) is(are) indeed "shall fail")should be reworded.
The standard says on strdup (page 1440):
44856 The strdup() function may fail if: 44857 [ENOMEM] Storage space available is insufficient.
The "may" fail is incorrect. Resource-not-available errors are mandatory.
------------------------------------------------------------------------
11 Solution proposed by the submitter (optional):
Action:
Replace "may" with "shall".
------------------------------------------------------------------------
Interpretation response ------------------------ The standards states the requirements for errors for these functions, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.
Rationale: ------------- It is accepted that the cases as noted would be better to be mandatory error conditions. This concern has been referred to the sponsor.
Back to IEEE Standards Interpretations for IEEE Std 1003.1-2001