Re: pkg.c revision 367687 breaks pkg

From: Scott Long <scottl_at_samsco.org>
Date: Sun, 15 Nov 2020 12:51:17 -0700
> On Nov 15, 2020, at 12:41 PM, Kyle Evans <kevans_at_FreeBSD.org> wrote:
> 
> On Sun, Nov 15, 2020 at 1:33 PM Guy Yur <guyyur_at_gmail.com> 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

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
Received on Sun Nov 15 2020 - 18:51:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:25 UTC