From owner-svn-src-head@freebsd.org Sun Nov 15 19:10:40 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 17C574653A4; Sun, 15 Nov 2020 19:10:40 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CZ1xq70RKz3HvK; Sun, 15 Nov 2020 19:10:39 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id D707F2A0DC; Sun, 15 Nov 2020 19:10:39 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id BA80927C0054; Sun, 15 Nov 2020 14:10:39 -0500 (EST) Received: from imap1 ([10.202.2.51]) by compute3.internal (MEProxy); Sun, 15 Nov 2020 14:10:39 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvledguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculddutddmnecujfgurhepofgfggfkjghffffhvffutgfgsehtqher tderreejnecuhfhrohhmpedfuehrrghnughonhcuuegvrhhgrhgvnhdfuceosggurhgrgh honheshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnhepieefgeeuveduffej teetjeejkeeftdetgffgieefgfetueegueekgeeutdduteejnecuffhomhgrihhnpehfrh gvvggsshgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepsggurhgrghhonhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthi dquddtgedvfeehkeeigedqudekuddtkeehuddqsggurhgrghhonheppefhrhgvvgeuufff rdhorhhgsehimhgrphdrtggt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7EDAFC200A5; Sun, 15 Nov 2020 14:10:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-570-gba0a262-fm-20201106.001-gba0a2623 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <202011150748.0AF7mqW3016900@repo.freebsd.org> <329C4753-BB97-4C67-8CDA-39EB67E16CE8@freebsd.org> Date: Sun, 15 Nov 2020 13:10:20 -0600 From: "Brandon Bergren" To: "Scott Long" , "Jessica Clarke" Cc: "Scott Long" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r367701 - head/lib/libutil Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 19:10:40 -0000 On powerpc64 and powerpc64le, there is some really weird behavior happen= ing around the sysctl itself: root@crow:~ # pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: N root@crow:~ # sysctl user.localbase user.localbase: /usr/local root@crow:~ # pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: N root@crow:~ # sysctl user.localbase=3D/usr/local user.localbase: /usr/local -> /usr/local root@crow:~ # pkg pkg: not enough arguments Usage: pkg [-v] [-d] [-l] [-N] [-j |-c |-r= ] [-C ] [-R ] [-o var=3Dv= alue] [-4|-6] [] For more information on available commands and options see 'pkg help'. root@crow:~ #=20 I would double check very closely that the sysctl is being called correc= tly, the sysctl tool manages to read it out, but libutil does not. On Sun, Nov 15, 2020, at 1:06 PM, Scott Long wrote: >=20 > > On Nov 15, 2020, at 12:01 PM, Jessica Clarke wr= ote: > >>=20 > >> I felt similar concerns, but my misunderstanding of strlcpy() drove= the > >> result. Since the use case for getlocalbase() lends itself to also= use > >> strlcat()/strlcpy(), I was trying to replicate the API semantics of= those, > >> at least to the limit of my understanding. Thanks for the feedback= , I=E2=80=99ll > >> look at it some more. > >=20 > > Thanks. ENOMEM also feels inappropriate as no allocation is taking > > place. Perhaps ENAMETOOLONG, which is used in similar cases for thin= gs > > like gethostbyname? Though sysctlbyname uses ENOMEM instead... sigh.= > >=20 >=20 > Yep, I wasn=E2=80=99t happy with ENOMEM either but I couldn=E2=80=99t = find anything better. >=20 > > Also, if pathlen has already been checked against SSIZE_MAX (giving > > EINVAL) and tmplen against pathlen there's no need to then check tmp= len > > against SSIZE_MAX. > >=20 >=20 > Done. >=20 > > I'd be happy to give a review on Phabricator if/when you have a new > > patch. > >=20 >=20 > https://reviews.freebsd.org/D27227 >=20 > Thanks, > Scott >=20 > --=20 Brandon Bergren bdragon@FreeBSD.org