From owner-svn-src-all@freebsd.org Sun Nov 15 20:49:12 2020 Return-Path: Delivered-To: svn-src-all@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 055BF468EAE for ; Sun, 15 Nov 2020 20:49:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (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 4CZ47W6JLZz3hH1 for ; Sun, 15 Nov 2020 20:49:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf36.google.com with SMTP id b11so7700530qvr.9 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=eg3eEZMlQvP1WfTYvaQ+QfZmPV0Ta4sHe40yD6UETz4Dc5NWRuyS2uxBWuvzwRwOFc D2CT6yay/fwuH7iOdlp9XES31zGu9FhJf1sYv8ZcVhyIP1Qx6xbh9JGA2/9Hua7YIcN1 tyube9gjpfM9nwy5B0kXd6StrSDNTeRHo67TblH46oWfwRwKXlrqs2oh2W31gOZtcaAa SJcmRUn4XQb/TXMrI26g0MpNs0IPg7g7p5CuJwZai24rUF5PupMhlE16Qo37kN20TWSJ MTH6ox3O4F2yvJd4Kfej95z1E1xAzOSN6txbxFfbToDnKyRBlRP49On23+C2gjgCfUIS pbUg== X-Gm-Message-State: AOAM532bquJ+2Ah1dpBLdAcUwiTnArbAzJyqqjYgKZ2QGOJe00wUYB6O KQJ0nznI89rCRFOp4s0R17Mu6XuZJ3N6PmTysE4wDA== 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: 4CZ47W6JLZz3hH1 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2020 20:49:12 -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