From owner-freebsd-current@freebsd.org Sun Nov 15 19:42:03 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 2C864466D19 for ; Sun, 15 Nov 2020 19:42:03 +0000 (UTC) (envelope-from kevans@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 4CZ2f30jXsz3MM6; Sun, 15 Nov 2020 19:42:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 022382A483; Sun, 15 Nov 2020 19:42:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f173.google.com with SMTP id q5so14649107qkc.12; Sun, 15 Nov 2020 11:42:02 -0800 (PST) X-Gm-Message-State: AOAM531BXd7gYLfuz/r25BJooXNDmhJ3tLxrWNMl4gQzR+0Gnt78ITZa Y1+4bnGjPDxSzEdchBcmqyQ5yAofvQHytY4U9uo= X-Google-Smtp-Source: ABdhPJzB5oWJo7Jiwg8L7kcS0PZfoCKCFlVu2b6/dti/21ga4I/aPWTxtyJ+rdgR7hbqGW/Atbdg6dCHWwv0Dykxumk= X-Received: by 2002:a37:9883:: with SMTP id a125mr11691044qke.430.1605469322640; Sun, 15 Nov 2020 11:42:02 -0800 (PST) MIME-Version: 1.0 References: <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com> In-Reply-To: <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com> From: Kyle Evans Date: Sun, 15 Nov 2020 13:41:51 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: pkg.c revision 367687 breaks pkg To: Guy Yur Cc: Scott Long , freebsd-current , kaktus@freebsd.org Content-Type: text/plain; charset="UTF-8" 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:42:03 -0000 On Sun, Nov 15, 2020 at 1:33 PM Guy Yur wrote: > > On 15/11/20 8:55 pm, Scott Long wrote: > > This is fixed in revision 367701 > > > > Scott > > Hi, > > 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. > > ssize_t tmplen; > char path[1000] = { 0 }; > > tmplen = getlocalbase(path, sizeof(path)); > printf("%s : %zd\n", path, tmplen); > > tmplen = sizeof(path); > if (sysctlbyname("user.localbase", path, (size_t *)&tmplen, NULL, 0) == 0) > printf("%s : %zd\n", path, tmplen); > > int mib[100] = { 0 }; > size_t miblen; > if (sysctlnametomib("user.localbase", mib, &miblen) == 0) { > for (int i = 0; i < miblen; i++) > printf("%d ", mib[i]); > printf("\n"); > } > > tmplen = sizeof(path); > if (sysctl(mib, miblen, path, (size_t *)&tmplen, NULL, 0) == 0) > printf("%s : %zd\n", path, tmplen); > > prints: > : 1 > : 1 > 8 21 > /usr/local : 11 > > Thanks, > Guy Yur > 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's. Thanks, Kyle Evans