[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] dpkg-query: --listfiles without package lists all files



* Guillem Jover <guillem@debian.org> [2022-09-17 10:24]:
On Mon, 2022-08-22 at 10:45:09 +0200, Jochen Sprickerhof wrote:
Btw. is there a similar feature to list all control files of all packages,
like dpkg-query -c dpkg?
Otherwise, would something like db-fsys:Control-Files be acceptable?

I'm trying to get rid of --control-path (see man page), so I'd rather not
add similar things as supported interfaces. :)

I'm trying to build something similar to the cruft(-ng) package to find non
package files. Would that be a feature for dpkg?

I had a branch that extends «dpkg --audit» with checks for unknown
database files under /var/lib/dpkg/, replicating in a built-in way
what the dpkg postinst script is currently doing (for that one-time
db recovery code). I guess that could be extended further to also check
for stuff under /var/lib/dpkg/info/. What are the checks you had in
mind? Whether there are files there for packages not currently preset?
Perhaps also for files that should not be present for say a package in
config-files state? Anything else?

I would like find all non package files on my filesystem. Currently I use this:

comm -13 \
  <(dpkg-query -Wf '${db-fsys:Files}\n' | cut -c2- | \
    sed -Ee 's#^/s?bin#/usr&#' -e 's#^/lib#/usr&#' | sort -u) \
  <(find / -xdev \
    \! -regex '/\(boot/grub\|etc/\(alternatives\|ssl\)\|home\|root\|tmp\|var/\(backups\|cache\|lib/dpkg\|log\|tmp\)\).*' \
    \! -path '*/__pycache__*' | sort)

I.e.: compare the list of files produced by dpkg-query with the list from find and exclude some directories that are allowed to change. I would like to reduce exclude this list and /var/lib/dpkg, thus my question for --control-path. What do you think of a dpkg tool producing such a list, like dpkg --audit-unknown?

Cheers Jochen

Attachment: signature.asc
Description: PGP signature


Reply to: