[Reproducible-commits] [dpkg] 01/02: Dpkg::Vendor::Debian: Disable fixdebugpath on unsafe characters in the path
Mattia Rizzolo
mattia at debian.org
Thu Jul 7 18:10:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 420c846c9d628eed49bd2e90c2dedb389d023942
Author: Guillem Jover <guillem at debian.org>
Date: Wed Jul 6 22:47:25 2016 +0200
Dpkg::Vendor::Debian: Disable fixdebugpath on unsafe characters in the path
---
scripts/Dpkg/Vendor/Debian.pm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 7616b7a..4a1d36d 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -163,9 +163,25 @@ sub _add_reproducible_flags {
fixdebugpath => 1,
);
+ my $build_path;
+
# Adjust features based on user or maintainer's desires.
$self->_parse_feature_area('reproducible', \%use_feature);
+ # Mask features that might have an unsafe usage.
+ if ($use_feature{fixdebugpath}) {
+ require Cwd;
+
+ $build_path = $ENV{DEB_BUILD_PATH} || Cwd::cwd();
+
+ # If we have any unsafe character in the path, disable the flag,
+ # so that we do not need to worry about escaping the characters
+ # on output.
+ if ($build_path =~ m/[^-+:.0-9a-zA-Z~\/_]/) {
+ $use_feature{fixdebugpath} = 0;
+ }
+ }
+
# Warn when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used.
if ($use_feature{timeless}) {
$flags->append('CPPFLAGS', '-Wdate-time');
@@ -173,8 +189,6 @@ sub _add_reproducible_flags {
# Avoid storing the build path in the debug symbols.
if ($use_feature{fixdebugpath}) {
- require Cwd;
- my $build_path = $ENV{DEB_BUILD_PATH} || Cwd::cwd();
my $map = '-fdebug-prefix-map=' . $build_path . '=.';
$flags->append('CFLAGS', $map);
$flags->append('CXXFLAGS', $map);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list