From owner-freebsd-current@freebsd.org Sun Nov 15 19:51:20 2020 Return-Path: Delivered-To: freebsd-current@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 806A4467133 for ; Sun, 15 Nov 2020 19:51:20 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CZ2rm2JRSz3N4Y; Sun, 15 Nov 2020 19:51:20 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id B53AC6D4; Sun, 15 Nov 2020 14:51:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 15 Nov 2020 14:51:19 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvledgudefgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutgho thhtucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucggtffrrghtth gvrhhnpeefjeeggfejhffgtdejveejkeegveeileeuheejgfduteevgfdttefggfeggfdv geenucfkphepkedrgeeirdekledrvddufeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehstghothhtlhesshgrmhhstghordhorhhg X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id DD32A328005E; Sun, 15 Nov 2020 14:51:17 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: pkg.c revision 367687 breaks pkg From: Scott Long In-Reply-To: Date: Sun, 15 Nov 2020 12:51:17 -0700 Cc: Guy Yur , freebsd-current , kaktus@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com> To: Kyle Evans X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CZ2rm2JRSz3N4Y X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2020 19:51:20 -0000 > On Nov 15, 2020, at 12:41 PM, Kyle Evans wrote: >=20 > On Sun, Nov 15, 2020 at 1:33 PM Guy Yur wrote: >>=20 >> On 15/11/20 8:55 pm, Scott Long wrote: >>> This is fixed in revision 367701 >>>=20 >>> Scott >>=20 >> Hi, >>=20 >> I am on revision 367710 (newer) and have the same problem. >> sysctlbyname() returns an empty string and length of 1. >> sysctl() with name converted to mib works fine. >>=20 >> ssize_t tmplen; >> char path[1000] =3D { 0 }; >>=20 >> tmplen =3D getlocalbase(path, sizeof(path)); >> printf("%s : %zd\n", path, tmplen); >>=20 >> tmplen =3D sizeof(path); >> if (sysctlbyname("user.localbase", path, (size_t *)&tmplen, NULL, 0) = =3D=3D 0) >> printf("%s : %zd\n", path, tmplen); >>=20 >> int mib[100] =3D { 0 }; >> size_t miblen; >> if (sysctlnametomib("user.localbase", mib, &miblen) =3D=3D 0) { >> for (int i =3D 0; i < miblen; i++) >> printf("%d ", mib[i]); >> printf("\n"); >> } >>=20 >> tmplen =3D sizeof(path); >> if (sysctl(mib, miblen, path, (size_t *)&tmplen, NULL, 0) =3D=3D 0) >> printf("%s : %zd\n", path, tmplen); >>=20 >> prints: >> : 1 >> : 1 >> 8 21 >> /usr/local : 11 >>=20 >> Thanks, >> Guy Yur >>=20 >=20 > This is a separate (valid) problem, but not directly related to > Scott's work here. sysctlbyname now goes directly to the kernel with > no chance for the user.* sysctls to intercept. That should > independently be fixed to maintain the illusion that they're real > sysctl=E2=80=99s It turns out the my userland, kernel, and startup scripts were out of sync and this was succeeding in error for me. Thanks for the hint, I think I have it working now. Scott