Re: dpkg and hardlinks
On Tue, Mar 24, 2009 at 02:09:25PM +0100, Raphael Hertzog <email@example.com> wrote:
> On Tue, 24 Mar 2009, Jerome Warnier wrote:
> > For files from packages, though, deduplication might be a good idea, as
> > dpkg is supposedly the only one to ever modify the files (under /usr for
> > example).
> > I don't know however how dpkg treats hardlinks. Does it "break" the
> > hardlink before replacing a file or does it replace the file whatever
> > its real nature is?
> IIRC dpkg preserves hardlinks inside a binary package but I don't see how
> it could do the same across multiple binary packages.
I think the question is more something like:
Package foo has file a
Package bar had file b
They are actually the same content, so the user hardlinks a and b.
What happens when bar is updated with a different b file ?
The answer, AFAIK, is that dpkg will do the right thing, namely, to
replace the content of b, but not of a, because it actually doesn't put
the content in b but rather in another file that it renames, eventually,
On the other hand, if package bar is updated with an unmodified b, the
hardlink will be broken anyway, because dpkg does the above even when files
are not modified. But I could be wrong on this one.