[PATCH 0/2] strlcpy/strlcat/wcslcpy/wcscat implementation

Alejandro Colomar alx.manpages@gmail.com
Wed Apr 5 12:30:32 GMT 2023


Hi Florian,

On 4/5/23 13:20, Florian Weimer via Libc-alpha wrote:
> These two patches add support for four functions planned for addition to
> POSIX, plus their fortified variants.  They are available with
> _DEFAULT_SOURCE because the BSDs expose them by default, oto.
> 
> Tested on i686-linux-gnu and x86_64-linux-gnu.  Built with
> build-many-glibcs.py (on all ABIs, but not all targets because disk
> space is no longer sufficient on the lab machines I have access to).
> 
> Paul, the Austin Groups issue you raised has been closed.  Do you keep
> your sustained objection to adding these functions to glibc?

Just adding a data point about this:

In shadow, we improved existing code going from strncpy(3) to strlcpy(3).
See <https://github.com/shadow-maint/shadow/pull/609>.

In some cases, as corretly pointed out by Paul, we could futher improve
some cases by just calling strcpy(3).  However, in some others,
strlcpy(3) was the sanest API, and while we could check prior to
strcpy(3)/memcpy(3) with strlen(3), that was unnecessarily cluttering
the code.  See <https://github.com/shadow-maint/shadow/pull/681>.

So I like the idea of adding this API to glibc.  In fact, it would
reduce the need for libbsd in some packages like shadow (although we
still need it for readpassphrase(3)).

Cheers,
Alex

> 
> Thanks,
> Florian
> 
> Florian Weimer (2):
>   Implement strlcpy and strlcat [BZ #178]
>   Add the wcslcpy, wcslcat functions
>
-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20230405/cf11f179/attachment.sig>


More information about the Libc-alpha mailing list