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

Cross-directory hard links in Debian packages


The tar file format supports hard links. Thus technically Debian
packages can contain hard links. A significant number of packages
including key packages such as bzip2, gzip, and ifupdown use this
technique. While same-directory hard links are an established practise,
the same is not so true for cross-directory hard links.

A good reason to use hard links is to save space. There are a number of
packages that ship the same content in multiple locations. The
alternative, soft links, has the downside of consuming inodes. When a
package ships very many duplicate small files, the savings for using
soft links are small compared to the savings achievable with hard links.
Also it is often not clear which of the copies is to be considered the
"canonical location".

The policy has an own stance on hard links in binary packages:
 * 10.7.3 conffiles must not be hard links
 * 12.1 manual page directories should not contain hard links
        (without giving a rationale for this)

Lintian interprets policy 10.7.3 to also cover cross-directory hard
links (package-contains-hardlink):
| The package contains a hardlink in /etc or across different directories. This
| might not work at all if directories are on different filesystems (which can
| happen anytime as the system administrator sees fit), certain filesystems such
| as AFS don't even support cross-directory hardlinks at all.

Clearly, packages must not use hard links across usual mount locations
such as /usr. Unpacking a package with a hard link across different
filesystems simply fails with an error from tar.

How many people really use AFS for storing their system? Are there other
filesystems with a similar restriction? Is this aspect practically

I propose to explicitly permit packages to use cross-directory hard
links within package-owned directories such as

About half of the packages flagged by lintian
use cross-directory hard links in this way.

Possible actions:
 * Update the lintian check to exempt a few locations from the check.
 * Update the policy to clarify which kinds of cross-directory hard
   links are permitted. This is mostly a matter of documenting
   established practise and the number of violations will be low in any


Reply to: