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

Bug#213907: Dynamic registration of files to packages



Package: dpkg
Severity: wishlist

We all agree that the package management system is one of the nicest
features of Debian.  It's very helpful to use dpkg to find out to
which package a file belongs (dpkg -S).  However, in many cases,
prominent files (e.g.  /etc/hosts, /etc/passwd) don't belong to any
package at all.  This fact is confusing because the files must have
been created somehow and it decreases the usefulness of the
packagement system.

Two examples illustrate this point:

 1. 'dpkg -S /etc/passwd' returns 'dpkg: /etc/passwd not found.'
    Further investigation shows that this file is created in the
    postinst script of the base-passwd package.

    /var/lib/dpkg/info/base-passwd.postinst:

    if [ ! -e /etc/passwd ] ; then
    	cp /usr/share/base-passwd/passwd.master /etc/passwd
    fi

 2. % dpkg -S /usr/bin/vi
    dpkg: /usr/bin/vi not found.
    % ll /usr/bin/vi
    lrwxrwxrwx    1 root     root           20 2003-09-12 00:08 /usr/bin/vi -> /etc/alternatives/vi
    % ll /etc/alternatives/vi
    lrwxrwxrwx    1 root     root           12 2003-09-29 12:56 /etc/alternatives/vi -> /usr/bin/vim
    % dpkg -S /usr/bin/vim
    vim: /usr/bin/vim

In both cases, the files belong to a package in some way and still
'dpkg -S' doesn't show it.

I want all files in /etc to have a proper owner which is shown with
dpkg -S.  For this, a dynamic mechanism is needed to tell dpkg to
which package a file belongs.  This is needed because not all files
can be part of the package itself, but need to be created at a later
time (e.g. in a postinst script).

This fexible mechanism, dpkg-registerfile (or whatever it will be
called) should take two arguments: the file and the package to which
the file belongs.  The script could then, similarly to dpkg-divert,
put the information in /var/lib/dpkg (The script must also have the
capability to remove the information again in case a file is being
deleted).  Of course, dpkg has to be made aware of this.

The examples given above could easily be adapted to comply to this
policy:

 1. The postinst script of base-passwd should say:

    if [ ! -e /etc/passwd ] ; then
    	cp /usr/share/base-passwd/passwd.master /etc/passwd
    	dpkg-registerfile /etc/passwd base-passwd
    fi

 2. The solution for this example is to have update-alternatives
    call dpkg-registerfile

    Obviously, dpkg-registerfile must also be able to re-register a
    file or change the package a file belongs to because
    update-alternatives might change the situation.

This is a bug report based on a mail I sent to -dpkg in November
2000.  There was some discussion following my posting; see
http://lists.debian.org/debian-dpkg/2000/debian-dpkg-200011/msg00025.html

-- 
Martin Michlmayr
tbm@cyrius.com



Reply to: