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

    From Jochen Sprickerhof@21:1/5 to All on Sun Aug 21 21:00:01 2022
    ---
    man/dpkg-query.pod | 2 +-
    man/dpkg.pod | 2 +-
    src/main/main.c | 2 +-
    src/query/main.c | 24 ++++++++++++++++++++----
    4 files changed, 23 insertions(+), 7 deletions(-)

    diff --git a/man/dpkg-query.pod b/man/dpkg-query.pod
    index ade71db25..53ab4e3b7 100644
    --- a/man/dpkg-query.pod
    +++ b/man/dpkg-query.pod
    @@ -137,7 +137,7 @@ When multiple I<package-name> entries are listed, the requested status
    entries are separated by an empty line, with the same order as specified
    on the argument list.

    -=item B<-L>, B<--listfiles> I<package-name>...
    +=item B<-L>, B<--listfiles> [I<package-name>...]

    List files installed to your system from I<package-name>. When multiple
    I<package-name>s are listed, the requested lists of files are separated
    diff --git a/man/dpkg.pod b/man/dpkg.pod
    index f09b7c0d1..2aa2fbecc 100644
    --- a/man/dpkg.pod
    +++ b/man/dpkg.pod
    @@ -596,7 +596,7 @@ List packages matching given pattern.

    Report status of specified package.

    -=item B<-L>, B<--listfil
  • From jspricke@debian.org@21:1/5 to All on Sun Aug 21 21:00:01 2022
    From: Jochen Sprickerhof <jspricke@debian.org>

    ---
    man/dpkg-query.pod | 2 +-
    man/dpkg.pod | 2 +-
    src/main/main.c | 2 +-
    src/query/main.c | 24 ++++++++++++++++++++----
    4 files changed, 23 insertions(+), 7 deletions(-)

    diff --git a/man/dpkg-query.pod b/man/dpkg-query.pod
    index ade71db25..53ab4e3b7 100644
    --- a/man/dpkg-query.pod
    +++ b/man/dpkg-query.pod
    @@ -137,7 +137,7 @@ When multiple I<package-name> entries are listed, the requested status
    entries are separated by an empty line, with the same order as specified
    on the argument list.

    -=item B<-L>, B<--listfiles> I<package-name>...
    +=item B<-L>, B<--listfiles> [I<package-name>...]

    List files installed to your system from I<package-name>. When multiple
    I<package-name>s are listed, the requested lists of files are separated
    diff --git a/man/dpkg.pod b/man/dpkg.pod
    index f09b7c0d1..2aa2fbecc 100644
    --- a/man/dpkg.pod
    +++ b/man/dpkg.pod
    @@ -596,7 +596,7 @@ List packages matching given pattern.

    Report status of specified package.

    -=item B<-L>, B<--listfil
  • From jspricke@debian.org@21:1/5 to All on Sun Aug 21 21:20:01 2022
    From: Jochen Sprickerhof <jspricke@debian.org>

    ---
    man/dpkg-query.pod | 2 +-
    man/dpkg.pod | 2 +-
    src/main/main.c | 2 +-
    src/query/main.c | 24 ++++++++++++++++++++----
    4 files changed, 23 insertions(+), 7 deletions(-)

    diff --git a/man/dpkg-query.pod b/man/dpkg-query.pod
    index ade71db25..53ab4e3b7 100644
    --- a/man/dpkg-query.pod
    +++ b/man/dpkg-query.pod
    @@ -137,7 +137,7 @@ When multiple I<package-name> entries are listed, the requested status
    entries are separated by an empty line, with the same order as specified
    on the argument list.

    -=item B<-L>, B<--listfiles> I<package-name>...
    +=item B<-L>, B<--listfiles> [I<package-name>...]

    List files installed to your system from I<package-name>. When multiple
    I<package-name>s are listed, the requested lists of files are separated
    diff --git a/man/dpkg.pod b/man/dpkg.pod
    index f09b7c0d1..2aa2fbecc 100644
    --- a/man/dpkg.pod
    +++ b/man/dpkg.pod
    @@ -596,7 +596,7 @@ List packages matching given pattern.

    Report status of specified package.

    -=item B<-L>, B<--listfil
  • From Guillem Jover@21:1/5 to Jochen Sprickerhof on Mon Aug 22 01:00:01 2022
    Hi!

    On Sun, 2022-08-21 at 20:44:32 +0200, Jochen Sprickerhof wrote:
    diff --git a/man/dpkg-query.pod b/man/dpkg-query.pod
    index ade71db25..53ab4e3b7 100644
    --- a/man/dpkg-query.pod
    +++ b/man/dpkg-query.pod
    @@ -137,7 +137,7 @@ When multiple I<package-name> entries are listed, the requested status
    entries are separated by an empty line, with the same order as specified
    on the argument list.

    -=item B<-L>, B<--listfiles> I<package-name>...
    +=item B<-L>, B<--listfiles> [I<package-name>...]

    List files installed to your system from I<package-name>. When multiple
    I<package-name>s are listed, the requested lists of files are separated

    Hmm, this does not seem to fit entirely the --listfiles action, and
    diverges from its interface, but in any case I think the following
    would be an existing and equivalent replacement:

    $ dpkg-query -f '${db-fsys:Files}\n' -W

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jochen Sprickerhof@21:1/5 to All on Mon Aug 22 10:50:01 2022
    Hi Guillem,

    * Guillem Jover <guillem@debian.org> [2022-08-22 00:55]:
    On Sun, 2022-08-21 at 20:44:32 +0200, Jochen Sprickerhof wrote:
    diff --git a/man/dpkg-query.pod b/man/dpkg-query.pod
    index ade71db25..53ab4e3b7 100644
    --- a/man/dpkg-query.pod
    +++ b/man/dpkg-query.pod
    @@ -137,7 +137,7 @@ When multiple I<package-name> entries are listed, the requested status
    entries are separated by an empty line, with the same order as specified
    on the argument list.

    -=item B<-L>, B<--listfiles> I<package-name>...
    +=item B<-L>, B<--listfiles> [I<package-name>...]

    List files installed to your system from I<package-name>. When multiple
    I<package-name>s are listed, the requested lists of files are separated

    Hmm, this does not seem to fit entirely the --listfiles action, and
    diverges from its interface, but in any case I think the following
    would be an existing and equivalent replacement:

    $ dpkg-query -f '${db-fsys:Files}\n' -W

    That's perfect, thanks!

    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 build something similar to the cruft(-ng) package to find
    non package files. Would that be a feature for dpkg?

    Cheers Jochen

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEc7KZy9TurdzAF+h6W//cwljmlDMFAmMDQhEACgkQW//cwljm lDP3Ug/9Fq8mVXJa4lKgcLmzsX9sEHa34b0blNe864JFdnFWW8qdmA04UkALaDUV ULyi4vJzTuUhwG3bAFQ+e9jzFu/hpAgqUSa95PiwxeOMIKZAnFv6kJDXQAvbgV9x c08QO+BiG3Iz1RrrcLk/pWreg57VGZ1hbXNpo+nuSnfvY3pMBd1F1bxjLN9KUjrm mv2cDEXXWxFf+xf+n/yNK3De9BZbQ0bs+7oYRnAYpT4ybUf1qwG7y7Lvg9Bb42nj c1j2wXMYMjNSUPgZB7N3prmhZJrgXA1yoSc/0XMcAZAL+Ys2HuPUFGJHMmo51Ne3 r5hsMBm4vwznL17K87v0cTFVwWNvYAJXkPJ3OZlCntx/wTcBEdKzlJlz2sDoAbTk Q4LfWzQOiV96/Cj7WSZ0rgLsckJd6akqjQYbPT6IDmtkM3onclPDgAlrzVap1f7s AjbsK5vNZ9nnZ0XRit/4YnQd64Q5XX3nI6Lod34brpwzCK39T5LrB8mygTw9ZXnO 6tOB/r3TrKy04iGw6uPyEVa5N0aiVZuwTb9pFPQ96vcqrAkqjH2r/q5dGAExiiXF zPuEtT79uKTre8JPtkphCLls5MR+NF494fht3zbwi2Lm/vco+cV7wXBAUgdlo3t1 l0I9q54lV96C3yu5YZY/uGQtWKLU9VbC3NlJaAmme0nJTO5ODQ8=
    =FpjX
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Guillem Jover@21:1/5 to Jochen Sprickerhof on Sat Sep 17 10:30:01 2022
    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?

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jochen Sprickerhof@21:1/5 to All on Sat Sep 17 12:50:01 2022
    * 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

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEc7KZy9TurdzAF+h6W//cwljmlDMFAmMlpP0ACgkQW//cwljm lDPKMhAAqBtwWnVBjAm+Se1UQgvzzdlfIq4dQ3xJsoFYuWntaFg+lsxki6lp0md6 cHIj55/Tih9tfGT6HQvlasTgc8NlPkldLc2gE5WRy9+3JK7MellMlf9j3DOFUOav JvPbEbFx7s4bxquUXFo/Vrr85YKn1LiQadXlQn0zn8EoxmgIYWxhAhzb/CcMHWxX Uba2N1025VBLUfprBA/JGOEAe2rr0LM0gey/F1vEaFjO01e7hiWgPBVMq70jUkVU 7NEyBdEs2hCvag6bnKCs9jrpTX8ZwSwUvyWLqtg5mriukot0NiLVyJis/IO/4hPU A3P/MTA5I8XUgZbppeW/gfjrYtcQxJdKgmSOwHli9q5JR8QYknsaDU8cgb0EoDz5 Q0CsooA7TQlsLqB74PMCl0ExgYziCcSeaVFJR46UqRJBVyKQau0fXa6xpjZBECFc o4dbVyumYd+rwPocLDJNvW/3HBC3XWRL2FfbBv1G0O6U6ujSwUHpoynlkyn41oyn u2U6/aQUw9PslABttuh3Kb+jAW9FbZOkVuHd2CbkL0UhUXJdDsFqukp60CXESzOU Lo6DRAGuKUg1JCGG9llY9xDig9RMJWn0YbWk1KDhNg5Pj39e+mlavFm9CNiQYDsu hUsr8uSCKLlwgz0YP6x6Y565cYxtwBM7G4xmByi4gia3Api/vfI=
    =jR/u
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)