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

Bug#255819: debian-policy: unclear about how packages should move dirs while allowing compat symlinks



Package: debian-policy
Version: 3.6.1.0
Severity: normal

Background:

  Occasionally directories are moved from one tree to another, and
 maintainers want to keep compat symlinks for various reasons.
 
  However, section 6.5. of current policy (Details of unpack phase of
 installation or upgrade) reads:
 
          A directory will never be replaced by a symbolic link to a
          directory or vice versa; instead, the existing state (symlink or
          not) will be left alone and `dpkg' will follow the symlink if
          there is one.

That appears to mean that package maintainers should handle this in some
way, as explained back in 2001 in http://bugs.debian.org/17624.  At that
time it seems there was information about this in the now-dead packaging
manual.

I could find no current guidelines about how this common operation ought to
be done.  Several docbook packages show the following in their postinst:

# do symlinks manually, til I figure out the problem
if [ "$1" = configure ]; then
    rm -rf /usr/share/sgml/docbook/custom/html-forms
    cd /usr/share/sgml/docbook/custom
    ln -s ../../../xml/docbook/custom/html-forms html-forms
fi

Doing so somewhat defeats the purpose of implementing the policy item copied
above, but indeed I cannot see how this could be safely and consistently
handled.

In such simple cases as docbook-xml addons, it is highly probable that the
postinst snippet above is sufficient, but there are cases where it will be
problematic.

Even in this case, there is at least one other possiblity I can think of,
which would be to use "rmdir" instead of "rm -rf", since when the rm is
valid, it means that the package is the only owner of this dir, and at that
time there should be no more files in it.  If there are any other files,
then the package probably lacks a conflict with the package owning those
files, and removing them would be an error.

I suggest that the policy says something like:

	If a package has to replace a directory with a symbolic link, then,
	in addition to shipping that new version of the file in the package,
	it must remove (using rmdir) that old directory in its postinst, and
	declare a (usually versionned) conflict with all other packages
	owning files under this directory.
	
-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>



Reply to: