From owner-svn-src-head@freebsd.org Sun Nov 15 20:49:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2BED468BE0 for ; Sun, 15 Nov 2020 20:49:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CZ47W3zT0z3hH0 for ; Sun, 15 Nov 2020 20:49:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf33.google.com with SMTP id g19so7705455qvy.2 for ; Sun, 15 Nov 2020 12:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gstb9q6Mqcgc03Cx91iDY2X+M+D579tJRyz/1MeJuRk=; b=rGDocxF8n33Vkq+r9JR6GVje/Av0WybDs/OGAvlegqAmoGK+k/E65J7jWtH7VyLMOH ddT40KzcH9883KV94zWqacrhEXRcVubQCYmv0Qg7nf5nRgJcSyonTgkT3c6wTp2d36GZ 5zLhNRAW9DzcXHxVC+xMRljpmsNcn12Z4vPNYswd6l7GOLsgc+DmiAhnSA7j8M+PyBks 6lWyj/Cx3JfVvCOYjYXeDgHRIlsQHoM08m9jg0ajJHfQzpQXtcgSiSSab6SgNejorxHX +ieufCjkkz3DkdtowTv6yywY3NmgJl4BbGrAUFQ0mC75it0wX8GeQKxIKPA/NW1nIQi0 B11w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gstb9q6Mqcgc03Cx91iDY2X+M+D579tJRyz/1MeJuRk=; b=jDAoj2tKbNa8RgXAU2o4sXzLgzXPKe7ZrQ3TH/NSWb0Xn1nw7DCFgNzOv+yIKnoG1L n77u7ApnT3PZfhvm/0x17TcYIrU556XbbsGNQDe9kXyD/1N+o2YHawM2ZswDdlIt4RFC W5buK99aqJ3HxInXzPAOrXS5si9YPWTKJA4l2Af/qgFRVnOQzLTitcc8BZpOkjylj2TK 3MRIKF0EMZRn8pWMKSbkz5+YQh9AK9SHrRitZRvXZUmoQ/V3qEqQYZ5OVwlrqIYhKArK Is3TpON76dm4mJ10uuCDuA3JifIXKdpp3oSpUa2WK1QtAD4OjsW6YqT+lx6v+uJxfW0h nxyQ== X-Gm-Message-State: AOAM532h2WgxuuxL/juekmpm30gtJm4BcE1ot8kIAQYEVjgRhfv2HFIR D3JmglZPcu3nivh7ErGwBg+wYLwcdOUIkNp205rlsQ== X-Google-Smtp-Source: ABdhPJw7EZP3wImjf6aHqIMeVssgue0bKYxV+CaXY4pzy4Z7mt8d8rOVu3I61vlPX5lgMc4xWSm6sN7aMjDOlXPHcXM= X-Received: by 2002:ad4:5b82:: with SMTP id 2mr2566140qvp.28.1605473349682; Sun, 15 Nov 2020 12:49:09 -0800 (PST) MIME-Version: 1.0 References: <202011150748.0AF7mqW3016900@repo.freebsd.org> <9578C457-F9C9-4B27-ACCE-1B66256B06A9@samsco.org> In-Reply-To: <9578C457-F9C9-4B27-ACCE-1B66256B06A9@samsco.org> From: Warner Losh Date: Sun, 15 Nov 2020 13:48:58 -0700 Message-ID: Subject: Re: svn commit: r367701 - head/lib/libutil To: Scott Long Cc: Jessica Clarke , Scott Long , src-committers , svn-src-all , svn-src-head , Stefan Esser X-Rspamd-Queue-Id: 4CZ47W3zT0z3hH0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2020 20:49:11 -0000 On Sun, Nov 15, 2020 at 1:13 PM Scott Long wrote: > > > On Nov 15, 2020, at 1:05 PM, Warner Losh wrote: > > > > Hey Scott, > > > > On Sun, Nov 15, 2020 at 11:46 AM Scott Long wrote: > > The man page for strlcpy() made reference to the return value being > > equivalent to what snprintf() does. The man page for snprintf() states > > that negatve return values are possible, so I assumed the same was > > true for strlcpy(). However, now that I=E2=80=99ve looked at the imple= mentation > > of strlcpy(), I see that you=E2=80=99re correct. The man pages are def= initely > > confusing, and this isn=E2=80=99t the only place where I think there=E2= =80=99s > > inconsistency in the documentation, or at least poor wording choices. > > > > Yea, it says both that it will never return a negative value (since > size_t is never negative) and that it returns the same things as snprintf > (which is true... except for that detail which it glosses over in return > type differences). > > > > So this issue doesn't get lost, I've added a clarification to the > examples in https://reviews.freebsd.org/D27228 . Please take a look and > let me know what you think. If more extensive edits are needed, there's > full context so you can at least flag those in the review as well. I've > read these too many times to see the other places you're talking about, s= o > a fresh set of eyes would be helpful. > > > > The wording on whether or not strlcpy and strlcat will provide NULL > termination is also inconsistent, hence my comments about it last weekend= . > I=E2=80=99m going to revert all of this back to and including r367075, si= nce Stefan > wants to do this a totally different way. Sorry for the noise everyone a= nd > thanks for the help, I learned a lot through this process. > OK. I'll update the man page to document the guaranteed behavior wrt NUL as well. I know what it's trying to say, but you are not the first person to stumble on these details. Thanks for pointing me at the ones that need improvement. And thanks for getting the localbase issue seen through. Warner