Hey Guillem.

On Fri, 2024-02-16 at 05:26 +0100, Guillem Jover wrote:
> 
> Thanks!

Well rather: thank you, for your constant efforts to DPKG and the whole
ecosystem.


> > At least it seems to make it impossible to definitely find out
> > whether a package
> > is not installed (respectively not existant).
> 
> Exactly.

Maybe it would also be worth to elaborate on:
       1   The  requested  query  failed  either fully or partially, due to no
           file  or  package   being   found   (except   for   --control-path,
           --control-list and --control-show were such errors are fatal).

My understanding would have been, that e.g. when searching for a
package, 1 would in practise mean that it doesn't exist at all (when
looking from APT’s PoV) respectively is in the state 'not-installed'.

So I guess for end-users it might be helpful to be told that, i.e. that
these two things (non-existing from APT) and non-installed are the same
from DPKG’s PoV, and would trigger 1.

Also perhaps notifying somewhere that 'not-installed' will never really
show up anywhere as a printed query result.



> This is used for field names, be them real or virtual, so erroring
> out
> on fields that do not exist would seem bad. But there's the
> distinction between the real fields and virtual ones, where the
> latter
> always contain a colon. So I guess I could make the latter, at least
> warn if they do not exist. My main concern with making them errors,
> is
> that this would break backwards and/or forwards compatibility, where
> you could not use a new or renamed field with old or new releases.

Warnings are at last difficult to use when scripting.

And btw: it also succeeds if there's no colon, e.g.:
$ dpkg-query --showformat='${foobar}' --show  2>/dev/null ; echo $?
0


Thanks,
Chris.

PS: In the dpkg-query manpage, there's:
           Desired action:

           u = Unknown
           i = Install
           h = Hold
           r = Remove
           p = Purge

           Package status:

           n = Not-installed
           c = Config-files
           H = Half-installed
           U = Unpacked
           F = Half-configured
           W = Triggers-awaiting
           t = Triggers-pending
           i = Installed

           Error flags:

           <empty> = (none)
           R = Reinst-required

I think, when these are actually printed, the full names are all
lowercase, i.e. installed not Installed ... might perhaps make sense to
align that?

Reply via email to