From owner-freebsd-current@freebsd.org Sun Nov 15 20:34:58 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 396874682EB for ; Sun, 15 Nov 2020 20:34:58 +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 4CZ3q610Qgz3QyY; Sun, 15 Nov 2020 20:34:58 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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 0F8762A6D3; Sun, 15 Nov 2020 20:34:58 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id n63so11256048qte.4; Sun, 15 Nov 2020 12:34:58 -0800 (PST) X-Gm-Message-State: AOAM533vfQJEY8UXnkl46I6LXU7QMCLYGV9zlJU4mkYdkJWChiFG5xTY ePYpRQ/HdubmTJEye9DUJ4EFAuFe+6LGdXwTFp8= X-Google-Smtp-Source: ABdhPJwv6uniSFluLyTXm298TRJh0hOT0OsuSoOmxyJ/v6+2t3UClwvN+rVsZ/yhAely9bTGcZhTLBtuh1mXSUhrp2o= X-Received: by 2002:ac8:4e87:: with SMTP id 7mr10922666qtp.310.1605472497645; Sun, 15 Nov 2020 12:34:57 -0800 (PST) MIME-Version: 1.0 References: <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com> In-Reply-To: From: Kyle Evans Date: Sun, 15 Nov 2020 14:34:46 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: pkg.c revision 367687 breaks pkg To: Stefan Esser Cc: Guy Yur , 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 20:34:58 -0000 On Sun, Nov 15, 2020 at 2:05 PM Stefan Esser wrote: > > Am 15.11.20 um 20:41 schrieb Kyle Evans: > > 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. > > user.localbase is a real sysctl, but with a default value returned > when sysctl(3) is used. > Yup. > The getlocalbase() function should not depend on this default value, > since it contains an identicl default value that can be returned if > sysctlbyname fails (or rather returns a zero length string in case > no other value has been written to the kernel). > I don't care about this particular application, to be honest, but about the general problem. libc has a sizable chunk of code in sysctl(3) dealing with user.* sysctls, and sysctlbyname will never see it. This isn't documented in the manpage, and IMO it's really just an oversight; libc should still be able to provide the values as seen in ^/lib/libc/gen/sysctl.c whether you've invoked sysctl() or sysctlbyname(). At a glance, it looks like localbase is the only one that's also tunable, most of these don't really even need to take a trip to the kernel to read. Thanks, Kyle Evans