On 2009-03-24, Mike Hommey <m...@glandium.org> wrote: > On Tue, Mar 24, 2009 at 02:09:25PM +0100, Raphael Hertzog > <hert...@debian.org> 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, > to b.
iirc, dpkg starts with chmod'ing 0600 a file and then replacing it. But let us test: s...@gladstone:/var/tmp/user$ ln /usr/bin/sudo s...@gladstone:/var/tmp/user$ ls -l -rwsr-xr-x 3 root root 113916 2009-01-27 19:57 sudo s...@gladstone:/var/tmp/user$ sudo apt-get --reinstall install sudo [many lines of apt] s...@gladstone:/var/tmp/user$ ls -l -rw------- 1 root root 113916 2009-01-27 19:57 sudo for non-suid files, it is a bit different: s...@gladstone:/var/tmp/user$ ln /bin/ls s...@gladstone:/var/tmp/user$ ls -l ls -rwxr-xr-x 2 root root 100564 2009-02-22 23:40 ls s...@gladstone:/var/tmp/user$ sudo apt-get --reinstall install coreutils s...@gladstone:/var/tmp/user$ ls -l ls -rwxr-xr-x 1 root root 100564 2009-02-22 23:40 ls /Sune -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org