On 2011-08-18 13:06 +0200, Igor Pashev wrote:

> Package: dpkg
> Version: 1.16.0.3
> Severity: normal
>
> By default all files in /etc are considered as config files and to be kept on
> package upgrade (or ask to user what to do with new config file).

Those which are shipped in packages as conffiles, yes.

> This works excelent for regular files, but can fail if there are two or more
> hardlinks to the same file, e. g. if /etc/init.d/script and
> /etc/rc2.d/S02script are the same file (latter *is not* a symlink).

If the hardlinks only exist on the filesystem, dpkg handles this
situation just fine, breaking the link if it replaces the conffile.
It's a different story if hardlinks to conffiles are contained in the
package, though.

> I can just guess the reason:
> dpkg *moves* old conffile and then tries to create hardlink to file that is 
> not
> exists any more.
>
> Synopsis:
> root@myhost:~/tmp/bug# dpkg -c ../hardlink-bug_40-0-0_all.deb
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./etc/
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./etc/rc2.d/
> -rw-r--r-- root/root        29 2011-08-16 13:10 ./etc/rc2.d/file1
> hrw-r--r-- root/root         0 2011-08-16 13:10 ./etc/rc2.d/file2 link to
> ../etc/rc2.d/file1
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./usr/
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./usr/share/
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./usr/share/doc/
> drwxr-xr-x root/root         0 2011-08-16 13:10 ./usr/share/doc/hardlink-bug/
> -rw-r--r-- root/root         0 2011-08-16 00:53 ./usr/share/doc/hardlink-
> bug/copyright
> -rw-r--r-- root/root       153 2011-08-16 00:57 ./usr/share/doc/hardlink-
> bug/changelog.Debian.gz
> root@myhost:~/tmp/bug# dpkg -i ../hardlink-bug_40-0-0_all.deb
> Processing in zone: global
> (Reading database ... 108804 files and directories currently installed.)
> Preparing to replace hardlink-bug 40-0-0 (using 
> ../hardlink-bug_40-0-0_all.deb)
> ....
> Unpacking replacement hardlink-bug ...
> dpkg: error processing ../hardlink-bug_40-0-0_all.deb (--install):
>  error creating hard link `./etc/rc2.d/file2': No such file or directory
> Errors were encountered while processing:
>  ../hardlink-bug_40-0-0_all.deb

It's not clear to me what the contents of the old version and the
situation on the filesystem were, but this is reproducible even on fresh
install.  The reason is that conffile processing takes place after
unpacking all non-conffiles, so for hardlinks to conffiles you hit the
ENOENT bug.  If a file is both a conffile and a hardlink in the package,
it is treated as the latter.

BTW, your example had a few errors, I'm attaching a corrected version.

Cheers,
       Sven

Attachment: hardlink-bug_40.tar.gz
Description: Binary data

Reply via email to