This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] Implement strlcpy [BZ #178]


On 11/06/2015 01:09 PM, Adhemerval Zanella wrote:
> 
> 
> On 06-11-2015 02:01, Rich Felker wrote:
>> On Thu, Nov 05, 2015 at 01:11:04PM -0800, Roland McGrath wrote:
>>> I still concur with Paul that we should not have this API in libc.
>>
>> I think we're in agreement that it's not a "good API", but nonetheless
>> I see strong reasons for including them and no non-ideological reasons
>> not to. These have been covered in detail before so I won't repeat
>> them again unless you really want me to. Do you disagree with my
>> reasoning here?
>>
>> Rich
>>
> 
> Roland, I tend to agree with Paul also, but nonetheless any reasoning 
> against this API is not refraining developers to continue reimplement 
> and use this set of functions.

My understanding is that there are several arguments for adding this API
(e.g., widely used in existing open source projects, performance,
specific existing use cases, portability) and against (e.g., encourages
possible security issues, additional maintenance,
similar-to-existing-API-but-yet-different-approach).

As a mere user, I have never needed strlcpy myself. Given that this
function is quite easy to realize, I see no reason to include such
a function in glibc. Also, I see only little value in improving the
portability with BSDs beyond POSIX, really. Thus, the real value of
adding this function appears to be convenience reasons. Anyway, this
is my personal view. As Rich stated, the arguments have been on the
table several times and it is not my intent to restart the discussion.

Instead, my proposal is to add this function to glibc, but in a separate library.
Also, I would like to see a comment like "Do not use this function unless
you really know what you do. Consider strncpy instead." in the documentation
(and man pages, eventually).

Thoughts?










Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]