Re: pkg-query(8): unknown query format key: '%i'

From: Stefan Esser <se_at_FreeBSD.org>
Date: Tue, 15 Aug 2023 13:33:54 UTC
Am 15.08.23 um 14:06 schrieb Graham Perrin:
> 
> On 15/08/2023 08:30, Graham Perrin wrote:
>> %o works, why does %i not work?
>>
>>
>> % pkg query '%o' sddm
>> x11/sddm
>> % pkg query '%i' sddm
>> Unknown query format key: '%i'
>> %
>>
>>
>> <https://man.freebsd.org/cgi/man.cgi?query=pkg-query&sektion=8&manpath=freebsd-ports>
> 
> Someone responded off-list.
> 
> I half-get it now, %i is a variable under 
> <https://man.freebsd.org/cgi/man.cgi?query=pkg-query&sektion=8&manpath=freebsd-ports#EVALUATION_FORMAT>.
> 
> Originally, what I wanted was, to get additional information.
> 
> Now, I can't figure out how to use %i as a variable.

I had looked at a man-page that documents the currently implemented
functionality of the pkg command, and it did not mention '%i'.

But looking at the sources of pkg-1.20.5 and 1.20.99.5, '%i' is in
fact mentioned in both pkg-query.8 and pkg_printf.3 - but neither of
the source files does contain code to support that variable ...

Checking the repository, I see that support for %i had been added
to the pkg query man page back in 2012:

	https://github.com/freebsd/pkg/commit/966b5b4c07

But looking at the sources from that time, support for %i did not exist
then, but might just have been proposed.

See for example the table starting at line 45 in a version from 2014:

	https://github.com/freebsd/pkg/blob/1.3.0.a2/src/query.c

I did not check all versions in the repository, but some between 2012
and the example from 2014 above. Maybe there is some mention of it in
the mail list archive ...

Regards, STefan