Re: new module 'strlcpy'

2017-09-27 Thread Dmitry Selyutin
How about strscpy from the Linux kernel? https://www.kernel.org/doc/htmldocs/kernel-api/API-strscpy.html 28 сент. 2017 г. 4:23 ДП пользователь "Paul Eggert" написал: > On 09/27/2017 05:35 PM, Bruno Haible wrote: > >> strlcpy with __warn_unused_result__ is the best solution for this task. >> > >

Re: new module 'strlcpy'

2017-09-27 Thread Paul Eggert
On 09/27/2017 05:35 PM, Bruno Haible wrote: strlcpy with __warn_unused_result__ is the best solution for this task. No it's not, because strlcpy always computes the string length of the source, and that is neither necessary nor desirable. Furthermore, in the bad style of programming that uses

Re: new module 'strlcpy'

2017-09-27 Thread Jim Meyering
On Wed, Sep 27, 2017 at 5:44 PM, Bruno Haible wrote: > I wrote: >>In some places the users >>will notice that strlcpy does not buy them much, compared to the >>"avoid arbitrary limits"[1] approach, and will switch over to what >>you call "GNU style". In other places, they will inse

Re: new module 'strlcpy'

2017-09-27 Thread Bruno Haible
I wrote: >In some places the users >will notice that strlcpy does not buy them much, compared to the >"avoid arbitrary limits"[1] approach, and will switch over to what >you call "GNU style". In other places, they will insert an abort() >or assert() to handle the truncation case

Re: new module 'strlcpy'

2017-09-27 Thread Bruno Haible
Hi Paul, > Anyway, strlcpy is overkill here, as snprintf does the job just as well > here Not at all. snprintf is not at the right level of abstraction. There are three levels of abstractions to consider: (1) C code which composes a memory region by writing to bytes individually. (2) C cod

Re: new module 'strlcpy'

2017-09-27 Thread Paul Eggert
I'd really rather not promote the use of strlcpy in GNU code, as it is contrary to GNU style. Plus, I'm not a fan of __warn_unused_result__; in my experience it's too often more trouble than it's worth, and I expect this trouble would occur with strlcpy if we started using it. That being said,

new module 'strlcpy'

2017-09-27 Thread Bruno Haible
Paul Eggert wrote: > @@ -48,7 +48,8 @@ get_locale_dependent_values (struct locale_dependent_values > *result) >snprintf (result->numeric, sizeof (result->numeric), > "%g", 3.5); >/* result->numeric is usually "3,5" */ > - strcpy (result->time, nl_langinfo (MON_1)); > + strnc

Re: [libvirt] gnulib tests in libvirt broken by newer glibc 2.26

2017-09-27 Thread Eric Blake
[adding gnulib] On 09/27/2017 04:36 PM, Christian Ehrhardt wrote: > Hi, > there seems to be an incompatibility to the last glibc due to [1]. Gnulib needs to be updated to track the glibc changes (it looks like that is actually under way already), then libvirt needs to pick up the updated gnulib.

Re: [PATCH v2 1/2] posix: Add compat glob symbol to not follow dangling symbols

2017-09-27 Thread Andreas Schwab
I can confirm that make works properly with the compat glob symbol. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."