Re: Recent changes to pkg argument parsing (https://reviews.freebsd.org/D49977)

From: Ronald Klop <ronald-lists_at_klop.ws>
Date: Tue, 06 May 2025 10:26:26 UTC
Van: Matthew Seaman <matthew@FreeBSD.org>
Datum: dinsdag, 6 mei 2025 11:04
Aan: freebsd-current@freebsd.org
Onderwerp: Re: Recent changes to pkg argument parsing (https://reviews.freebsd.org/D49977)
> 
> On 06/05/2025 09:18, Dan Mahoney (Ports) wrote:
> > For example, we've got a cron job on every box that gathers all our leaf packages into a file:
> >
> > #!/bin/sh
> > /usr/sbin/pkg query -e '%#r == 0' '%n-%v'
> >
> > We now get warnings:
> >
> > # /usr/local/libexec/pkgleaf
> > pkg: invalid option -- e
> >
> > (but the query still runs).
> >
> > Has anyone else seen this?
> 
> This is pkg(7) struggling to parse options that it doesn't do anything with other than pass them through to the real pkg(8).
> 
> As said elsewhere in the thread, a fix for the problem has been committed to base.  Until that makes its way through the system into a release, you can work around the problem by changing your command to:
> 
> /usr/local/sbin/pkg query -e '%#r == 0' '%n-%v'
> 
> ie. call pkg(8) directly rather than via pkg(7).
> 
>     Cheers,
> 
>     Matthew
>  
> 
> 
> 
>  


The bug has never been in any release. It was only in 15-CURRENT since April 30th.

Regards,
Ronald.