View Issue Details

IDProjectCategoryView StatusLast Update
00020111003.1(2024)/Issue8System Interfacespublic2026-11-29 12:39
Reporterromanzilka Assigned To 
PrioritylowSeverityEditorialTypeOmission
Status NewResolutionOpen 
NameRoman Žilka
Organization
User Reference
Sectionstrerror
Page Number0
Line Number0
Interp Status
Final Accepted Text
Summary0002011: strerror*(): Redundant and/or missing statement reg. repeated call
DescriptionThe section on strerror*() mentions twice, in the 3rd and 4th paragraph of the Description, that the string returned by strerror() may be overwritten "by a subsequent call to strerror_l() in the same thread".

Note that while the Description clearly states that strerror() may use the same buffer on each call, it never makes such a statement about strerror_l(). It is strongly suggested, but not stated plainly. If strerror_l() may re-use a buffer, it should be made explicit.
Desired ActionRemove the sentence: "The string may be overwritten by a subsequent call to strerror_l() in the same thread."

Possibly rephrase the early segments of the Description to state explicitly that strerror_l() may use the same buffer for output on each call.
TagsNo tags attached.

Activities

romanzilka

2026-11-29 09:57

reporter   bugnote:0007567

The aforementioned rephrasing of the early segments of the Description might look as follows. (The change affects more than just the early segments, in fact.) Rationale for the broad change: firstly, strerror_l() is brought into the early sentence "The strerror() function shall map the error number", so that the following paragraph may achieve the initial goal of succinctly noting that strerror() and strerror_l() may share a buffer. After that, the mention of "locale-dependent error message" in the new sentence needs fixing, because each function applies a different locale. This provides an opportunity for the removal of redundant text.

1. Change the sentence

"The strerror() function shall map the error number in errnum to a locale-dependent error message string and shall return a pointer to it."

to

"The strerror() and [CX]strerror_l()[/CX] functions shall map the error number in errnum to a locale-dependent error message string and shall return a pointer to it. strerror() follows the [CX]LC_MESSAGES category setting of the[/CX] current locale[CX], while strerror_l() follows the locale represented by locale[/CX]."

If the role of LC_MESSAGES isn't a CX, omit the label there.

2. Change the sentence

"The returned string pointer might be invalidated or the string content might be overwritten by a subsequent call to strerror(), or by a subsequent call to strerror_l() in the same thread."

to

"The string pointer returned [CX]by either function[/CX] might be invalidated or the string content might be overwritten by a subsequent call to [CX]any of: strerror_l() in the same thread, [/CX]strerror()."

3. Remove the sentence

"The contents of the error message strings returned by strerror() should be determined by the setting of the LC_MESSAGES category in the current locale."

4. Remove the sentence

"The strerror_l() function shall map the error number in errnum to a locale-dependent error message string in the locale represented by locale and shall return a pointer to it."

romanzilka

2026-11-29 12:39

reporter   bugnote:0007568

Note that if strerror() and strerror_l() are allowed to share output buffer, thread-safety of strerror_l(), as well as the stability of what strerror_l() returns over time are brought into question. But that's another matter.

Also, a correction of note 7567, item 2: a piece of information should be labeled [CX].

Change the proposed text

"The string pointer returned [CX]by either function[/CX] might be invalidated or the string content might be overwritten by a subsequent call to [CX]any of: strerror_l() in the same thread, [/CX]strerror()."

to

"[CX]The string pointer returned by either function might be invalidated or[/CX] the string content might be overwritten by a subsequent call to [CX]any of: strerror_l() in the same thread, [/CX]strerror()."

Issue History

Date Modified Username Field Change
2026-11-28 23:58 romanzilka New Issue
2026-11-29 09:57 romanzilka Note Added: 0007567
2026-11-29 12:39 romanzilka Note Added: 0007568