Bug#836075: libfile-stripnondeterminism-perl: hard-link is destroyed after normalization
AYANOKOUZI, Ryuunosuke
i38w7i3 at yahoo.co.jp
Tue Aug 30 13:03:36 UTC 2016
Package: libfile-stripnondeterminism-perl
Version: 0.023-2
Severity: normal
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: toolchain
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org
Dear maintainer,
Current file handlers is considering file mode, but other file attributes
(Ex. user ID, group ID, inode number, link counts, ...) are not considered.
It means that a file with same file name before and after normalization
could have different file attributes except for file mode.
This would cause some problem.
Suppose that we have a debian package which is packaged by "debhelper"
and that "debian/rule" execute "rdfind -makehardlinks true"
in "override_dh_auto_install" target to reduce package size
using hard-link of duplicated files in the package [1].
[1] https://wiki.debian.org/dedup.debian.net
"dh_strip_nondeterminism" target is executed
after "override_dh_auto_install" (hard-linking).
In the target, File::StripNondeterminism module
create new normalized file which has different inode number from target file
and rename() the normalized file to the target file it data has changed.
Because inode number has changed after rename().
hard-link status of files by "rdfind" could be changed [2].
This cause duplicated files in final package
in spite of "rdfind" invocation in "dh_strip_nondeterminism" target.
[2] hard-link status could be changed.
$ (umask 0006; convert xc:none /tmp/preserve_file_attributes.v1YRi3/ln_target.png)
$ ln /tmp/preserve_file_attributes.v1YRi3/ln_target.png /tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png
$ stat /tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png /tmp/preserve_file_attributes.v1YRi3/ln_target.png
File: ‘/tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png’
Size: 272 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 498297 Links: 2
Access: (0660/-rw-rw----) Uid: ( 1000/********) Gid: ( 1000/********)
Access: 2016-08-30 21:53:27.562341916 +0900
Modify: 2016-08-30 21:53:27.558341948 +0900
Change: 2016-08-30 21:53:27.558341948 +0900
Birth: -
File: ‘/tmp/preserve_file_attributes.v1YRi3/ln_target.png’
Size: 272 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 498297 Links: 2
Access: (0660/-rw-rw----) Uid: ( 1000/********) Gid: ( 1000/********)
Access: 2016-08-30 21:53:27.562341916 +0900
Modify: 2016-08-30 21:53:27.558341948 +0900
Change: 2016-08-30 21:53:27.558341948 +0900
Birth: -
$ perl -I lib/ bin/strip-nondeterminism /tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png
$ stat /tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png /tmp/preserve_file_attributes.v1YRi3/ln_target.png
File: ‘/tmp/preserve_file_attributes.v1YRi3/ln_hardlink.png’
Size: 155 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 498310 Links: 1
Access: (0660/-rw-rw----) Uid: ( 1000/********) Gid: ( 1000/********)
Access: 2016-08-30 21:53:27.850341897 +0900
Modify: 2016-08-30 21:53:27.846341898 +0900
Change: 2016-08-30 21:53:27.846341898 +0900
Birth: -
File: ‘/tmp/preserve_file_attributes.v1YRi3/ln_target.png’
Size: 272 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 498297 Links: 1
Access: (0660/-rw-rw----) Uid: ( 1000/********) Gid: ( 1000/********)
Access: 2016-08-30 21:53:27.850341897 +0900
Modify: 2016-08-30 21:53:27.558341948 +0900
Change: 2016-08-30 21:53:27.846341898 +0900
Birth: -
To fix this issue and
to preserve as much file attribute information of target file as possible,
I prepared a patch to "master" branch of official repository [3].
I would like someone to request review the patch and merge it to the branch.
[3] https://anonscm.debian.org/git/reproducible/strip-nondeterminism.git/log/?h=master
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
Versions of packages libfile-stripnondeterminism-perl depends on:
ii libarchive-zip-perl 1.59-1
ii perl 5.22.2-3
libfile-stripnondeterminism-perl recommends no packages.
libfile-stripnondeterminism-perl suggests no packages.
-- no debconf information
Sincerely yours,
Ryuunosuke Ayanokouzi
--
AYANOKOUZI, Ryuunosuke <i38w7i3 at yahoo.co.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Preserve-file-attribute-information-of-target-file.patch
Type: application/octet-stream
Size: 9403 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20160830/b98615c3/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20160830/b98615c3/attachment.sig>
More information about the Reproducible-builds
mailing list