Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 2020 21:33:31 +0200
From:      Guy Yur <guyyur@gmail.com>
To:        Scott Long <scottl@samsco.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: pkg.c revision 367687 breaks pkg
Message-ID:  <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com>
In-Reply-To: <EC6FF21B-109A-45EE-97F2-A04B1F195DFA@samsco.org>
References:  <A3B7709B-8C16-48E0-9A6C-E45D206F6DE6@gmail.com> <EC6FF21B-109A-45EE-97F2-A04B1F195DFA@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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

>
>> On Nov 15, 2020, at 11:52 AM, Manfred Antar <manfredantar@gmail.com> wrote:
>>
>> pkg.c revision 367687 breaks pkg :
>>
>> (pkg)5052}pkg
>> The package management tool is not yet installed on your system.
>> Do you want to fetch and install it now? [y/N]:
>>
>> This is after upgrading to the latest pkg and libutil.
>> pkg.c version 367075 works:
>>
>> (pkg)5057}pkg
>> pkg: not enough arguments
>> Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>]
>>
>> For more information on available commands and options see 'pkg help’.
>>
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4e5fe0a6-7325-d413-f68f-2c0ebaa34763>