Hi Eric! On Thu, Jun 20, 2024 at 10:37:08AM GMT, Eric Blake wrote: > In today's Austin Group meeting (the group behind POSIX), it was noted > that there is a potential discrepancy between C2Y and POSIX regarding > whether strnlen(3) operates on "strings" (the C standard defines this > as a NUL-terminated sequence) vs. length-limited arrays of characters > (which may or may not contain a NUL byte within the bounds given). > > https://www.austingroupbugs.net/view.php?id=1834 > > One of the contributors to the C standard (Chris Bazeley) then replied > that his proposal for strnlen to C2Y was based in part on the existing > wording of https://man7.org/linux/man-pages/man3/strnlen.3.html, where > the man pages were not as precise as the POSIX Issue 8 wording, as > well as the fact that C is already inconsistent in its wording for > strnlen_s; although he also expressed an openness to revising his > draft based on consensus. > > It may be worth some preliminary cleanup patches to the Linux man > pages for strnlen and friends to follow the example of POSIX in > distinguishing when an argument is a string (must have NUL terminator) > vs a length-bounded array of bytes (which may or may not include a NUL > terminator), to make it easier for everyone to share common wording > when C2Y eventually adds the function. Agree. I wrote a couple of years ago string_copying(7), which sets a consistent wording for functions that copy, but I haven't revised other functions, such as strnlen(3). I'll revise this when I find some time. In the meantime, I suggest to have a look at string_copying(7). BTW, I'll revise the wording in case it can be made more consistent with POSIX. Have a lovely day! Alex -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature