Debian Bug report logs - #638291
dpkg: Hardlinks problem with conffiles

version graph

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg.

Reported by: Igor Pashev <pashev.igor@gmail.com>

Date: Thu, 18 Aug 2011 10:09:10 UTC

Severity: normal

Tags: patch

Found in version dpkg/1.16.0.3

Fixed in version dpkg/1.16.1

Done: Guillem Jover <guillem@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, pashev.igor@gmail.com, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Thu, 18 Aug 2011 10:09:13 GMT) Full text and rfc822 format available.

Acknowledgement sent to Igor Pashev <pashev.igor@gmail.com>:
New Bug report received and forwarded. Copy sent to pashev.igor@gmail.com, Dpkg Developers <debian-dpkg@lists.debian.org>. (Thu, 18 Aug 2011 10:09:15 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Igor Pashev <pashev.igor@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: dpkg: Hardlinks problem with conffiles
Date: Thu, 18 Aug 2011 14:06:24 +0300
[Message part 1 (text/plain, inline)]
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).

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).

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



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (600, 'unstable'), (550, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  coreutils               8.5-1            GNU core utilities
ii  libbz2-1.0              1.0.5-6          high-quality block-sorting file co
ii  libc6                   2.13-10          Embedded GNU C Library: Shared lib
ii  libselinux1             2.0.98-1.1       SELinux runtime shared libraries
ii  xz-utils                5.0.0-2          XZ-format compression utilities
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                           0.8.15.5   Advanced front-end for dpkg

-- no debconf information
[hardlink-bug.tar.gz (application/x-gzip, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sat, 20 Aug 2011 19:03:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac@gmx.de>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sat, 20 Aug 2011 19:03:06 GMT) Full text and rfc822 format available.

Message #10 received at 638291@bugs.debian.org (full text, mbox):

From: Sven Joachim <svenjoac@gmx.de>
To: Igor Pashev <pashev.igor@gmail.com>
Cc: 638291@bugs.debian.org
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sat, 20 Aug 2011 21:02:06 +0200
[Message part 1 (text/plain, inline)]
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

[hardlink-bug_40.tar.gz (application/octet-stream, attachment)]

Added tag(s) patch. Request was from Raphael Hertzog <hertzog@debian.org> to control@bugs.debian.org. (Sun, 21 Aug 2011 09:06:55 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sun, 21 Aug 2011 09:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 21 Aug 2011 09:15:08 GMT) Full text and rfc822 format available.

Message #17 received at 638291@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Sven Joachim <svenjoac@gmx.de>, 638291@bugs.debian.org
Cc: Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sun, 21 Aug 2011 11:04:40 +0200
[Message part 1 (text/plain, inline)]
tag 638291 + patch
thanks

On Sat, 20 Aug 2011, Sven Joachim wrote:
> 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.

The problem is that the hardlinking code is not aware that the target
file is still in .dpkg-new and not yet in its final location. This is
because conffile are not processed like normal files and thus do not
inherit the usual fnnf_deferred_rename flag.

The attached patch should tell dpkg to also use .dpkg-new for conffiles.
Not tested but it should be ok. Tell me if it works for you (not taking
the time to do it myself, since I'm in vacation).

Can you also turn your testcase in a patch against pkg-tests.git?

Thank you in advance.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)
[patch (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sun, 21 Aug 2011 10:03:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Игорь Пашев <pashev.igor@gmail.com>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 21 Aug 2011 10:03:09 GMT) Full text and rfc822 format available.

Message #22 received at 638291@bugs.debian.org (full text, mbox):

From: Игорь Пашев <pashev.igor@gmail.com>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 638291@bugs.debian.org
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sun, 21 Aug 2011 13:58:26 +0400
[Message part 1 (text/plain, inline)]
2011/8/20 Sven Joachim <svenjoac@gmx.de>

> 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.
>

Do I understand it right?
When installing a package:
1. Unpack all regular files (+ symlinks?), except conffiles.
2. Create hardlinks.
3. Process conffiles.
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sun, 21 Aug 2011 12:39:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Игорь Пашев <pashev.igor@gmail.com>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 21 Aug 2011 12:39:07 GMT) Full text and rfc822 format available.

Message #27 received at 638291@bugs.debian.org (full text, mbox):

From: Игорь Пашев <pashev.igor@gmail.com>
To: 638291@bugs.debian.org
Cc: hertzog@debian.org, Sven Joachim <svenjoac@gmx.de>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sun, 21 Aug 2011 16:37:11 +0400
[Message part 1 (text/plain, inline)]
Raphaël, your patch solves the problem,
al least I can't reproduce it any more.
Tried many times, conffiles are treated as expected.

Thanks!

Sven, also thanks for your corrections.
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sun, 21 Aug 2011 16:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac@gmx.de>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 21 Aug 2011 16:24:03 GMT) Full text and rfc822 format available.

Message #32 received at 638291@bugs.debian.org (full text, mbox):

From: Sven Joachim <svenjoac@gmx.de>
To: Raphael Hertzog <hertzog@debian.org>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sun, 21 Aug 2011 18:21:56 +0200
On 2011-08-21 11:04 +0200, Raphael Hertzog wrote:

> The problem is that the hardlinking code is not aware that the target
> file is still in .dpkg-new and not yet in its final location. This is
> because conffile are not processed like normal files and thus do not
> inherit the usual fnnf_deferred_rename flag.
>
> The attached patch should tell dpkg to also use .dpkg-new for conffiles.
> Not tested but it should be ok. Tell me if it works for you (not taking
> the time to do it myself, since I'm in vacation).

Works perfectly, thanks.

> Can you also turn your testcase in a patch against pkg-tests.git?

Once I have acquainted myself with the testsuite, probably yes.  Might
take a few days, I have other things to to as well.

Cheers,
       Sven





Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Sun, 21 Aug 2011 20:15:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Sun, 21 Aug 2011 20:15:06 GMT) Full text and rfc822 format available.

Message #37 received at 638291@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Sun, 21 Aug 2011 22:12:17 +0200
On Sun, 21 Aug 2011, Sven Joachim wrote:
> > Can you also turn your testcase in a patch against pkg-tests.git?
> 
> Once I have acquainted myself with the testsuite, probably yes.  Might
> take a few days, I have other things to to as well.

You might find
http://wiki.debian.org/Teams/Dpkg/Contribute#Contribute_a_non-regression_test
helpful. I'll gladly expand it if there are things missing in your
opinion.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)




Added tag(s) pending. Request was from Raphaël Hertzog <hertzog@debian.org> to control@bugs.debian.org. (Sun, 21 Aug 2011 20:15:08 GMT) Full text and rfc822 format available.

Message sent on to Igor Pashev <pashev.igor@gmail.com>:
Bug#638291. (Sun, 21 Aug 2011 20:15:10 GMT) Full text and rfc822 format available.

Message #42 received at 638291-submitter@bugs.debian.org (full text, mbox):

From: Raphaël Hertzog <hertzog@debian.org>
To: 638291-submitter@bugs.debian.org
Subject: Bug#638291 marked as pending
Date: Sun, 21 Aug 2011 20:13:55 +0000
tag 638291 pending
thanks

Hello,

Bug #638291 reported by you has been fixed in the Git repository. You can
see the changelog below, and you can check the diff of the fix at:

    http://git.debian.org/?p=dpkg/dpkg.git;a=commitdiff;h=277e572

---
commit 277e572facf30001d59bdadfe3e3c9e4db37ae1b
Author: Raphaël Hertzog <hertzog@debian.org>
Date:   Sun Aug 21 11:11:02 2011 +0200

    dpkg: correctly handle a hardlink pointing to a conffile
    
    Normal files tagged as a conffile are not tagged with
    fnnf_deferred_rename and due to this the hardlinking code
    was assuming that the target is in its final location
    already. This is obviously not the case for a conffile.
    
    Fix the code so that the hardlinking logic takes into account
    the fact that conffiles are unpacked in .dpkg-new and stay
    there until the configuration phase.
    
    Reported-by: Igor Pashev <pashev.igor@gmail.com>

diff --git a/debian/changelog b/debian/changelog
index ec2e9ae..4a0fee4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -99,6 +99,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * dpkg-source now properly cleans up the temporary tarball generated for
     native formats in case of unexpected interruption. Closes: #631494
   * Fix simplification logic of union dependencies. Closes: #637564
+  * Fix dpkg's handling of a hardlink pointing to a conffile. Closes: #638291
 
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Mon, 22 Aug 2011 17:12:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac@gmx.de>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Mon, 22 Aug 2011 17:12:03 GMT) Full text and rfc822 format available.

Message #47 received at 638291@bugs.debian.org (full text, mbox):

From: Sven Joachim <svenjoac@gmx.de>
To: Raphael Hertzog <hertzog@debian.org>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Mon, 22 Aug 2011 19:09:29 +0200
[Message part 1 (text/plain, inline)]
On 2011-08-21 22:12 +0200, Raphael Hertzog wrote:

> On Sun, 21 Aug 2011, Sven Joachim wrote:
>> > Can you also turn your testcase in a patch against pkg-tests.git?
>> 
>> Once I have acquainted myself with the testsuite, probably yes.  Might
>> take a few days, I have other things to to as well.
>
> You might find
> http://wiki.debian.org/Teams/Dpkg/Contribute#Contribute_a_non-regression_test
> helpful. I'll gladly expand it if there are things missing in your
> opinion.

Thanks, this was very helpful indeed.  After reading that, the only
pitfall I fell in was that git does not preserve hardlinks, so I needed
to handle that in build-hook/clean-hook targets.

The testcase in the attached patch slightly differs from the original
one in that the hardlink is not marked as a conffile itself.  This makes
no real difference when freshly installing the package, but on upgrades
the hardlink will be broken (since unchanged conffiles are not
replaced).

Cheers,
       Sven

[0001-New-test-t-conffile-hardlink.patch (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Tue, 23 Aug 2011 13:12:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Tue, 23 Aug 2011 13:12:10 GMT) Full text and rfc822 format available.

Message #52 received at 638291@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Tue, 23 Aug 2011 15:10:13 +0200
On Mon, 22 Aug 2011, Sven Joachim wrote:
> Thanks, this was very helpful indeed.  After reading that, the only
> pitfall I fell in was that git does not preserve hardlinks, so I needed
> to handle that in build-hook/clean-hook targets.

Right, I just noticed/remembered that we have t-unpack-hardlink already...
can you merge your test in that one?

It already tests hardlinks on various type of files, you'd just add a
test-conffile-link{0,1} and mark test-conffile-link{0,1} as conffiles.

> The testcase in the attached patch slightly differs from the original
> one in that the hardlink is not marked as a conffile itself.  This makes
> no real difference when freshly installing the package, but on upgrades
> the hardlink will be broken (since unchanged conffiles are not
> replaced).

Yes, that doesn't matter at all for the purpose of this test at least.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)




Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Tue, 23 Aug 2011 18:03:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac@gmx.de>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Tue, 23 Aug 2011 18:03:08 GMT) Full text and rfc822 format available.

Message #57 received at 638291@bugs.debian.org (full text, mbox):

From: Sven Joachim <svenjoac@gmx.de>
To: Raphael Hertzog <hertzog@debian.org>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Tue, 23 Aug 2011 20:00:47 +0200
[Message part 1 (text/plain, inline)]
On 2011-08-23 15:10 +0200, Raphael Hertzog wrote:

> On Mon, 22 Aug 2011, Sven Joachim wrote:
>> Thanks, this was very helpful indeed.  After reading that, the only
>> pitfall I fell in was that git does not preserve hardlinks, so I needed
>> to handle that in build-hook/clean-hook targets.
>
> Right, I just noticed/remembered that we have t-unpack-hardlink already...
> can you merge your test in that one?

Done in the attached patch.

> It already tests hardlinks on various type of files, you'd just add a
> test-conffile-link{0,1} and mark test-conffile-link{0,1} as conffiles.
>
>> The testcase in the attached patch slightly differs from the original
>> one in that the hardlink is not marked as a conffile itself.  This makes
>> no real difference when freshly installing the package, but on upgrades
>> the hardlink will be broken (since unchanged conffiles are not
>> replaced).
>
> Yes, that doesn't matter at all for the purpose of this test at least.

I've only made test-conffile-link0 a conffile and test-conffile-link1 a
hardlink to it.

Cheers,
       Sven

[0001-Add-test-for-hardlink-to-a-conffile-to-t-unpack-hard.patch (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#638291; Package dpkg. (Tue, 23 Aug 2011 19:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Dpkg Developers <debian-dpkg@lists.debian.org>. (Tue, 23 Aug 2011 19:36:03 GMT) Full text and rfc822 format available.

Message #62 received at 638291@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 638291@bugs.debian.org, Igor Pashev <pashev.igor@gmail.com>
Subject: Re: Bug#638291: dpkg: Hardlinks problem with conffiles
Date: Tue, 23 Aug 2011 21:32:31 +0200
On Tue, 23 Aug 2011, Sven Joachim wrote:
> > Yes, that doesn't matter at all for the purpose of this test at least.
> 
> I've only made test-conffile-link0 a conffile and test-conffile-link1 a
> hardlink to it.

The problem with this is that you don't know which copy will become
the main file in the tar archive and which one will be recorded as
a hardlink... and here it was reversed, i.e. link1 was the main file
and link0 the hardlink, defeating the test we wanted.

$ dpkg -c t-unpack-hardlink/pkg-hardlink.deb
drwxr-xr-x root/root         0 2011-08-23 21:27 ./
-rw-r--r-- root/root        26 2011-08-23 21:27 ./test-conffile-link1
brw-r--r-- root/root       1,0 2011-08-23 21:27 ./test-ram0-link0
hrw-r--r-- root/root         0 2011-08-23 21:27 ./test-conffile-link0 link to ./test-conffile-link1
prw-r--r-- root/root         0 2011-08-23 21:27 ./test-fifo-link1
brw-r--r-- root/root       1,0 2011-08-23 21:27 ./test-ram0-link1
-rw-r--r-- root/root        22 2011-08-23 21:27 ./test-file-link1
prw-r--r-- root/root         0 2011-08-23 21:27 ./test-fifo-link0
crw-r--r-- root/root       1,3 2011-08-23 21:27 ./test-null-link0
hrw-r--r-- root/root         0 2011-08-23 21:27 ./test-file-link0 link to ./test-file-link1
crw-r--r-- root/root       1,3 2011-08-23 21:27 ./test-null-link1

So I marked both as conffiles and merged your patch, thanks!

(At the same time I see that hardlinks to devices and fifo are not kept in the
tar archive...)

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)




Reply sent to Guillem Jover <guillem@debian.org>:
You have taken responsibility. (Fri, 23 Sep 2011 05:23:01 GMT) Full text and rfc822 format available.

Notification sent to Igor Pashev <pashev.igor@gmail.com>:
Bug acknowledged by developer. (Fri, 23 Sep 2011 05:23:01 GMT) Full text and rfc822 format available.

Message #67 received at 638291-close@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: 638291-close@bugs.debian.org
Subject: Bug#638291: fixed in dpkg 1.16.1
Date: Fri, 23 Sep 2011 05:17:21 +0000
Source: dpkg
Source-Version: 1.16.1

We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive:

dpkg-dev_1.16.1_all.deb
  to main/d/dpkg/dpkg-dev_1.16.1_all.deb
dpkg_1.16.1.dsc
  to main/d/dpkg/dpkg_1.16.1.dsc
dpkg_1.16.1.tar.bz2
  to main/d/dpkg/dpkg_1.16.1.tar.bz2
dpkg_1.16.1_amd64.deb
  to main/d/dpkg/dpkg_1.16.1_amd64.deb
dselect_1.16.1_amd64.deb
  to main/d/dpkg/dselect_1.16.1_amd64.deb
libdpkg-dev_1.16.1_amd64.deb
  to main/d/dpkg/libdpkg-dev_1.16.1_amd64.deb
libdpkg-perl_1.16.1_all.deb
  to main/d/dpkg/libdpkg-perl_1.16.1_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 638291@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillem Jover <guillem@debian.org> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Fri, 23 Sep 2011 06:00:11 +0200
Source: dpkg
Binary: libdpkg-dev dpkg dpkg-dev libdpkg-perl dselect
Architecture: source amd64 all
Version: 1.16.1
Distribution: unstable
Urgency: low
Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
Changed-By: Guillem Jover <guillem@debian.org>
Description: 
 dpkg       - Debian package management system
 dpkg-dev   - Debian package development tools
 dselect    - Debian package management front-end
 libdpkg-dev - Debian package management static library
 libdpkg-perl - Dpkg perl modules
Closes: 147583 231089 245322 293280 308082 454694 489771 525160 526774 552123 560070 560251 603435 604241 606839 608260 610940 615899 616609 619131 620312 620490 620520 621066 622094 626684 627462 628055 628726 629582 630533 630996 631435 631439 631494 631547 631757 631808 632168 632937 633539 633627 634510 634961 635467 635683 636700 637096 637564 638291 639229 639997 640198 640298 641834
Changes: 
 dpkg (1.16.1) unstable; urgency=low
 .
   [ Raphaël Hertzog ]
   * Dpkg::Deps: Implement new "reset" method and bump module version to 1.01
     due to this.
   * Improved description of --search in dpkg-query(1). Closes: #621066
     Thanks to Lars Buitinck <larsmans@gmail.com> for the patch.
   * Let update-alternatives fsync() its administrative files before
     moving them in place to avoid empty files with some filesystems.
     LP: #344019
   * Tighten the regexp used by dpkg-source to ignore the .pc directory of
     quilt. Thanks to Mike Hommey for noticing the problem.
   * Change behaviour of dpkg-source's --extend-diff-ignore to also
     extend the current diff-ignore if it has already been set.
   * Fix dependency checking code to consider a dependency on a virtual
     package provided by a package in triggers-pending status as satisfied.
   * Do not fail when encountering a pre-dependency in triggers-awaited state,
     instead process the awaited triggers. Closes: #526774
   * "any" no longer hides "all" in the Architecture field of a .dsc.
   * Fix dpkg --remove to really remove the triggers from the various
     internal files in /var/lib/dpkg/info/triggers/. Closes: #525160
   * Avoid a perl warning in dpkg-gensymbols when no symbols file has been
     generated (because it would have been empty). Closes: #626684
   * Re-enable the Package-List field but drop the Architecture column since we
     have no clear use case yet. It can always be added later on.
     Also drop the source line since it duplicates other fields.
     Closes: #619131
   * Add the extraction part of Dpkg::Source::Package to the supported API.
     Useful to extract source packages without having to depend on dpkg-source
     (and hence dpkg-dev).
   * Add the Dpkg::Vendor module to the supported API. Useful for lintian
     when dpkg-dev is absent.
   * Check presence of required parameters in dpkg-vendor. Closes: #628726
     Thanks to Niels Thykier <niels@thykier.net> for the patch.
   * Avoid a Perl warning in dpkg-buildflags when HOME is not set.
     Closes: #635467
   * dpkg-source can now also use debian/source/local-patch-header (that is not
     included in the generated source package) instead of
     debian/source/patch-header. Closes: #629582
   * Changed dpkg-source --after-build to automatically unapply patches that it
     has applied during --before-build.
   * Fix two possible causes for the assertion failure "pigp->trigpend_head".
     LP: #798793, #424358 Closes: #560251
   * Use "special" instead of "particular" to qualify the "3.0 (custom)" format
     in dpkg-source(1). Closes: #631435
   * Add some supplementary checks to ensure debian/control has the required
     fields. Closes: #631439
   * dpkg-gensymbols(1): document syntax of comments. Closes: #630996
   * Allow empty lines in symbols files to better delimit multiple libraries.
     Thanks to Cyril Brulebois <kibi@debian.org> for the patch.
   * dpkg: if "prerm upgrade" fails when downgrading, do not try to run
     "prerm failed-upgrade" with the prerm of the oldest prerm, it can't work
     around a bug of a newer prerm anyway.
   * dpkg: support new "interest-noawait" and "activate-noawait" trigger
     directives.
   * dpkg-buildflags(1): make it clear that DEB_*_(SET|APPEND) environment
     variables are meant for users and should not be used by packages.
   * update-alternatives: do not allow to reuse a slave link in another
     slave alternative. Closes: #631547
   * Improve dpkg-source's logic to identify ignored files. Closes: #632168
   * Fix a small typo in dpkg-source(1). Closes: #632937
   * Reword the description of dpkg-source --before-build and --after-build
     to be clearer. Closes: #608260
   * dpkg-buildpackage no longer exports the compiler flags. Closes: #560070
     Packages must directly call dpkg-buildflags to retrieve them.
   * dpkg-buildflags supports a prepend command to modify the build
     flags. Particularly useful for package maintainers who don't want
     their supplementary flags to take precedence over user submitted
     flags.
   * Add new --dump action to dpkg-buildflags and make it the default action.
     Closes: #603435
   * dpkg-mergechangelogs now checks the return value of the close() call.
     Thanks to Niels Thykier <niels@thykier.net> for the patch. Closes: #633539
   * Similar changes to dpkg-shlibdeps and dpkg-gencontrol, also by Niels.
   * Fix update-alternatives to not remove a real file when dropping a
     symlink for a slave that's not provided by the new current choice.
     Closes: #633627
   * Improve dpkg-source's error message complaining about the lack
     of the upstream tarball. Closes: #634510
   * Add some common makefile snippets for use in rules files in
     /usr/share/dpkg/: default.mk, architecture.mk, buildflags.mk, pkg-info.mk,
     vendor.mk Closes: #606839
   * Fix the dpkg-divert test-suite to also skip test that would fail if run
     under root. Closes: #634961
   * Change merge conflict separators created by dpkg-mergechangelogs to match
     the usual norm of being composed of 7 characters. LP: #815700
   * With source format 2.0 and 3.0 (quilt), dpkg-source now fails by default
     when upstream changes have not been recorded in a quilt patch. The new
     --commit operation can be used to properly record the changes before-hand.
     LP: #797839
     And it fails before installing the automatic patch in debian/patches/
     Closes: #615899
   * dpkg-buildflags now supports "--export=configure" to output compilation
     flags on a single line with double quotes as delimiter of the various
     values. It also uses DEB_<flag>_MAINT_<op> to let the maintainer
     extend the build flags to use. Last but not least, it can now also strip
     options from the returned build flags.
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
   * dpkg-source now properly cleans up the temporary tarball generated for
     native formats in case of unexpected interruption. Closes: #631494
   * Fix simplification logic of union dependencies. Closes: #637564
   * Fix dpkg's handling of a hardlink pointing to a conffile. Closes: #638291
   * Add example of extend-diff-ignore's usage in dpkg-source(1).
     Closes: #640198
   * dpkg-buildflags now returns hardening flags by default. Closes: #489771
     They can be individually enabled/disabled via DEB_BUILD_MAINT_OPTIONS,
     see dpkg-buildflags(1). Thanks to Kees Cook for his help.
 .
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520
   * Add ‘.gitmodules’ to the default dpkg-source ignore lists. Closes: #620490
   * Document in dpkg-query(1) man page that on --listfiles each list of
     files per package name is separated by a blank line. Same goes for
     --status and --print-avail.
   * Use execvp(3) unconditionally in command_exec(). Making the call always
     fallback to use the system shell in case of error, such as with empty
     maintainer scripts. Thanks to Jonathan Nieder <jrnieder@gmail.com>.
     Closes: #622094
   * Improve deb-split(5) format description by splitting debian-split
     member contents into a list.
   * Switch to debhelper compatibility level 7.
     - Use dh_prep instead of deprecated “dh_clean -k”.
   * Bump Standards-Version to 3.9.2 (no changes needed).
   * Generate filenames following current conventions on “dpkg-split --join”,
     by including the architecture in the debian-split member of a split
     package and using underscores to separate filename parts.
   * Support conffiles with spaces when diffing them. Closes: #147583
   * Allow installing packages with bogus versions with new
     --force-bad-version.
   * Do not fail when unpacking a diverted hardlink. Closes: #245322
     Based on a patch by Christopher Baines <cbaines8@gmail.com>.
   * Document in dpkg-deb(1) that --fsys-tarfile will always process the
     input archive sequentially. Closes: #616609
   * Remove long non-functional --new and --old dpkg-deb option handling
     from dpkg which were being treated as dpkg commands.
   * Remove reference to --nocheck dpkg-deb option from dpkg man page as
     the latter does not pass it to the former.
   * Clarify the current dpkg behaviour when running the dpkg-deb and
     dpkg-query back-ends, of not passing through back-end specific options
     when running them from dpkg. Closes: #610940
   * Use “unselected” as an adjective in dpkg output messages instead of
     “deselected”. Closes: #231089
   * Clarify exit status in dpkg-split and start-stop-daemon --help output.
   * Clarify “EXIT STATUS” section in man pages by using a table.
   * Add a --status command to start-stop-daemon returning LSB Init Script
     status action exit codes.
   * Add start-stop-daemon process name kernel limits for Solaris, NetBSD,
     OpenBSD, FreeBSD and Darwin.
   * On package removal, keep only directories actually containing conffiles,
     and not directories just matching the substring in the conffile or the
     directory itself. Thanks to Ondřej Surý <ondrej@debian.org>.
   * On purge correctly remove symlinks acting as directories, when they are
     not being used by any other package's files.
   * Do not lose track of parent directories on removal so that they can
     be properly cleaned up on purge if not used by any other package.
     Based on a patch by Ondřej Surý <ondrej@debian.org>. Closes: #454694
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
     Based on a patch by Jakub Wilk <jwilk@debian.org>. Closes: #627462
   * Do not allow blank lines in field values. Closes: #308082
   * Do not warn on missing architecture on packages in config-files state,
     but then make sure the architecture field is usable. Closes: #604241
   * Run du with --apparent-size when generating the Installed-Size field in
     dpkg-gencontrol to get consistent results independent of build system.
     Thanks to Ludovic Brenta <ludovic@ludovic-brenta.org>. Closes: #630533
   * Do not fail to unpack shared directories missing on the file system
     from packages being replaced by other packages. Closes: #631808
   * Do not require programs to define thisname, provide two new functions
     to handle the program name (dpkg_set_progname and dpkg_get_progname).
     Closes: #631757
   * Man pages cleanup:
     - Rename “USAGE” dselect(1) section to “ACTIONS” and clarify they can
       be performed interactively or from command line.
     - Add missing built-in methods to dselect(1).
     - Add missing escaping to field dashes in deb-control(5).
     - Use dashes instead of underscores for variable text.
     - Clarify that several front-end fields are not dselect specific in
       dpkg-query(1).
     - Use [option...] instead of [options] and friends.
     - Use italics or bold instead of surrounding the text with <>.
     - Correctly format text with bold and italics.
     - Use minus signs and hyphens consistently in man pages.
     - Fix reference to /etc/dpkg/dselect.cfg.d instead of dpkg.cfg.d in
       dselect(1).
     - Add missing optional group|gid --chuid argument in start-stop-daemon(8).
   * Refer to Sources and Packages files as part of a repository instead of
     as being of exclusive use or owned by APT, which has never been the case.
   * Unify somewhat dpkg-maintscript-helper --help output with other commands.
   * Add build-indep and build-arch targets as aliases for build in
     debian/rules.
   * Use the perl interpreter found by configure to call dpkg-architecture.pl
     in the m4 DPKG_ARCHITECTURE macro.
   * Add new --verbose option to dpkg-deb and change --extract to honour it.
     Closes: #293280
   * Add new --raw-extract option to dpkg-deb combining --control and
     --extract. Closes: #552123
   * Defer hardlink renames so that there's never a point were the new
     file contents are accessible from the final path before they have
     been fsync()ed and cannot be executed causing ETXTBSY when trying
     to open the to be installed paths for writing.
     Thanks to Jonathan Nieder <jrnieder@gmail.com>. Closes: #635683
   * Clarify the default dpkg-deb compression-levels on the man page.
   * Clarify dpkg --update-avail usage error message. Closes: #628055
   * Change Dpkg::Compression default values depending on the compressor
     used, and as such dpkg-source inherits this functionality.
     Prompted by Timo Juhani Lindfors <timo.lindfors@iki.fi>.
   * Print an actual error or warning message instead of assert()ing on
     readlink()/stat() size discrepancies. Closes: #639229
   * Update alternative links only if they change. This allows for a
     read-only file system and a writable database. Closes: #636700
     Based on a patch by Salvatore Bonaccorso <carnil@debian.org>.
   * Fix double “error:” string in dpkg missing PATH error output.
     Closes: #639997
   * Do not warn on strange timestamps when unpacking with dpkg-deb.
     Closes: #640298
   * Reduce dpkg-trigger binary size by refactoring libdpkg modules so that
     it does not end up pulling triglib.
   * Reduce dpkg-deb binary size by refectoring libdpkg modules so that it
     does not end up pulling triglib.
   * Do not fail on --compare-version when generating parse warnings.
     Existing packages with invalid versions should not fail on their
     maintainer scripts due to that.
   * Use the user name (instead of the user id) when setting the supplementary
     groups in start-stop-daemon. Closes: #641834
   * Use --srcdir and --destdir po4a options, and bump Build-Depends version
     to 0.36.4.
 .
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
   * Swedish (Peter Krefting).
   * French (Christian Perrier).
 .
   [ Updated man page translations ]
   * French (Christian Perrier).
   * German (Helge Kreutzmann) including improvement by "Flo".
   * Swedish (Peter Krefting).
 .
   [ Updated scripts translations ]
   * French (Christian Perrier, Sylvestre Ledru). Closes: #637096
   * German (Helge Kreutzmann).
   * Swedish (Peter Krefting).
Checksums-Sha1: 
 d8d9d5a8a9f134459987f5b187527c303498e902 1364 dpkg_1.16.1.dsc
 9e8176c88fe2b31782ddae6d0a8f599c7e540e8d 5432348 dpkg_1.16.1.tar.bz2
 a830d5633da7a96d5208a6f8a7a97e24865e7913 552790 libdpkg-dev_1.16.1_amd64.deb
 470de180ac9fa5c95abfcf30a4d9a46cab269107 2218686 dpkg_1.16.1_amd64.deb
 6e6ddbb681d1bbbb971299932f99d43a35f33750 1006884 dselect_1.16.1_amd64.deb
 b8394b2dfd4291ff206dec00e53c723fa0be902e 923836 dpkg-dev_1.16.1_all.deb
 7940dc852c11e3a386ce014cd39ab7ce30e34f30 806604 libdpkg-perl_1.16.1_all.deb
Checksums-Sha256: 
 3f1649796856228545ba610df340b47b923a31f6ebe8765c8f48e1dac7f11391 1364 dpkg_1.16.1.dsc
 f9363628a6fa1c24a1e9c41bd8977f9d5a7010bfca3ac9a6f8bf500e7e8df52b 5432348 dpkg_1.16.1.tar.bz2
 96910fa1ed1371aa2b9e3147eecdf67e4e5f61fe7d7aaa97c27254f55a92c56d 552790 libdpkg-dev_1.16.1_amd64.deb
 d0e9691aa05c1b2567b06df0856ea05a211234e40dbc955e0266fa45fb32370c 2218686 dpkg_1.16.1_amd64.deb
 4a1c44c98791f1aa1b59bfc4890a3f6aeef70319f930e1ca9b7354ede8e78125 1006884 dselect_1.16.1_amd64.deb
 885d13576b93262151b5e920dd8971072668c0bd36b103ab0e82b97fcef52fcd 923836 dpkg-dev_1.16.1_all.deb
 b6fa511f2b059a85e3d5938c73a5805893a28438785a974bf0e46a53dc5da975 806604 libdpkg-perl_1.16.1_all.deb
Files: 
 c1e7858da79770b64427a99cc628889c 1364 admin required dpkg_1.16.1.dsc
 b94c9ed2493fd9dbb53a96f2e7f674ce 5432348 admin required dpkg_1.16.1.tar.bz2
 99bbb9c901e7462d06472a27ffb6d67f 552790 libdevel optional libdpkg-dev_1.16.1_amd64.deb
 bed79ea34df74b42ebbc2ed13d3ed4cb 2218686 admin required dpkg_1.16.1_amd64.deb
 bd018624eca8f1cf04a0b588a6338622 1006884 admin optional dselect_1.16.1_amd64.deb
 78c00b38545303cf8c8fcd4dd83f30a3 923836 utils optional dpkg-dev_1.16.1_all.deb
 f604975f555da4f710167be2b0d468f7 806604 perl optional libdpkg-perl_1.16.1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk58Dr0ACgkQuW9ciZ2SjJtZVwCgkPiancaq9ojJ2L0b8uEEjSC7
87YAoKtmUCgXZS/CfakXx860t2ijO84f
=Cq2h
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 31 Oct 2011 07:42:13 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 04:15:03 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.