Subject: Pkgviews and symlinks
To: None <firstname.lastname@example.org>
From: None <email@example.com>
Date: 05/04/2004 09:39:42
Yesterday's hacking session was about enabling wm/ion to
pkgviews. Well, it didn't work. It exposed a bug in
pkgviews in how it handles symlinks.
'pkg_admin check' can be used to check if a package has
not been tampered, and it is used at deinstall time to
avoid removing changed files.
For regular files, it uses MD5 checksums, and that is OK
with linkfarm since we're looking for a file, so it can
be symlinked too.
For symlinks, however, it is different: the 'value' of
the symlink is stored in the +CONTENTS file. I don't
think there is another way of checking integrity of a
symlink, since as our /etc/malloc.conf, it might point
to no actual file.
This is a problem with pkgviews, because the linkfarm
creates a link to the symlink inside the view. When it
is the default view, the package can be checked, and will
be checked, by e.g. 'make deinstall' through pkg_admin.
And that will fail on symlinks.
I'm thinking of 4 solutions to solve this, but each one
has its drawbacks:
1. Modify linkfarm so it copies over symlinks instead of
linking to them. It'd solve the checking issue, but
would break the package when the link points to a file
outside of it's depot directory: in pkgsrc we're making
all symlinks relatives, and when the directory depth is
not the same, they're broken.
2. Teach pkg_admin/default_view a bit more about views, so
that it can retrieve the correct value. But where to do
3. Hack pkg_admin so that it tries the symlink itself, the
target of the symlink, and so on until either the correct
value is found, or an error, or a recursion limit. Works,
but it's hacky.
4. Avoid using pkg_admin is the outlned situation, and use
something else that knows a bit more about symlinks. A
bit like 2.
Comments? I'm tempted to implement 3 ``for now'' and then
forget^Wdo something better later.