Thanks!
At least it seems to make it impossible to definitely find out
whether a package
is not installed (respectively not existant).
Exactly.
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.
Package: dpkg
Version: 1.22.4
Severity: normal
dpkg-query manpage says:
EXIT STATUS
0 The requested query was successfully performed.
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).
2 Fatal or unrecoverable error due to invalid command-line usage, or
interactions with the system, such as accesses to the database,
memory allocations, etc.
E.g.:
$ dpkg-query --showformat='${db:Status-Status}' --show --list 2>/dev/null ; echo $?
2
looks good, as does
$ dpkg-query --showformat='${db:Status-Status}' --show not-existing-package 2>/dev/null ; echo $?
1
But e.g.
$ dpkg-query --showformat='${db:Status-Statu' --show 2>/dev/null ; echo $?
1
causes also 1, though it fails because of the syntax error in the format string.
Shouldn't that be a 2?
At least it seems to make it impossible to definitely find out whether a package
is not installed (respectively not existant).
btw. it will also not fail at all in cases like:
$ dpkg-query --showformat='${db:Status-Statu}' --show 2>/dev/null ; echo $?
0
where the field doesn't exist. Not sure whether that’s desired or not
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (3 / 13) |
Uptime: | 35:41:29 |
Calls: | 10,392 |
Calls today: | 3 |
Files: | 14,064 |
Messages: | 6,417,151 |