[debhelper-devel] [debhelper] 02/02: dh_strip: disable file(1) cache when not using build-ids
Niels Thykier
nthykier at moszumanska.debian.org
Fri Jul 1 20:34:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 71a0569b9ca6f3ed90118485e8f855bc7a974ac3
Author: Niels Thykier <niels at thykier.net>
Date: Fri Jul 1 20:31:10 2016 +0000
dh_strip: disable file(1) cache when not using build-ids
It breaks in fun and exciting ways for hardlinked ELF binaries if we
are not using build-ids. For now just disable the file(1) caching
in that case as it is not critical and an uncommon case.
The build-id case works (thanks to Sven Joachim) since the deattached
debug symbol is in a predictable location we can test for.
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 5 +++++
dh_strip | 14 +++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1c6bdb8..b96ce30 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,11 @@ debhelper (9.20160618.1+unreleased) UNRELEASED; urgency=medium
(menu-methods are still installed).
* dh_*: Deprecate -s in favor of -a. The -s option is
removed in compat 11.
+ * dh_strip: Fix regression in 9.20160618, which caused
+ issues when there were hardlinked ELF binaries in a
+ package. Thanks to Sven Joachim for the report, the
+ analysis/testing and for providing a patch for the
+ most common case. (Closes: #829142)
[ Translations ]
* Update German translation (Chris Leick + Eduard Bloch)
diff --git a/dh_strip b/dh_strip
index 7d40c24..2f20dab 100755
--- a/dh_strip
+++ b/dh_strip
@@ -198,7 +198,7 @@ sub testfile {
# - *.node are also native ELF binaries (for node-js)
if ($fn =~ m/\.(?:so.*?|cmxs|node)$/) {
# Ok, do the expensive test.
- my $type=get_file_type($fn);
+ my $type=get_file_type($fn, 1);
if ($type=~m/ELF.*shared/) {
push @shared_libs, $fn;
return;
@@ -209,7 +209,7 @@ sub testfile {
my (undef,undef,$mode,undef)=stat(_);
if ($mode & 0111) {
# Ok, expensive test.
- my $type=get_file_type($fn);
+ my $type=get_file_type($fn, 1);
if ($type=~m/ELF.*(executable|shared)/) {
push @executables, $fn;
return;
@@ -230,8 +230,8 @@ sub testfile {
# I could just use `file $_[0]`, but this is safer
sub get_file_type {
- my ($file) = @_;
- return $file_output{$file} if $file_output{$file};
+ my ($file, $cache_ok) = @_;
+ return $file_output{$file} if $cache_ok && $file_output{$file};
open (FILE, '-|') # handle all filenames safely
|| exec('file', '-e', 'apptype', '-e', 'ascii', '-e', 'encoding',
'-e', 'cdf', '-e', 'compress', '-e', 'tar', $file)
@@ -247,7 +247,11 @@ sub make_debug {
# Don't try to copy debug symbols out if the file is already
# stripped.
- my $file_info = get_file_type($file);
+ #
+ # Disable caching for non-build-id based extractions.
+ # Unfortunately, it breaks when there are hardlinks to the same
+ # ELF files.
+ my $file_info = get_file_type($file, $use_build_id ? 1 : 0);
return unless $file_info =~ /not stripped/;
if ($use_build_id) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list