[Bug 2068653] [NEW] dpkg-buildflags Ubuntu vendor module incompatible with Debaain
Daria Brashear
2068653 at bugs.launchpad.net
Thu Jun 6 18:16:41 UTC 2024
Public bug reported:
Description: Ubuntu 24.04 LTS
Release: 24.04
dpkg:
Installed: 1.22.6ubuntu6
Candidate: 1.22.6ubuntu6
Version table:
*** 1.22.6ubuntu6 500
500 http://us.archive.ubuntu.com/ubuntu noble/main amd64 Packages
100 /var/lib/dpkg/status
expected: i expect dpkg-buildflags --get CFLAGS to include -ffile-
prefix-map=OLD=NEW by default.
observed: if run in a directory with a valid debian/changelog, dpkg-
buildflags --get CFLAGS includes both -ffile-prefix-map=OLD=NEW and
-fdebug-prefix-map=OLD=NEW. if run with no debian/changelog, it behaves
as expected.
analysis:
The Debian vendor module's "reproducible" support, which is what's also
documented by the reproducibility project, will include -ffile-prefix-
map=OLD=NEW (which is a superset of -fdebug-prefix-map=OLD=NEW) unless
you explicitly opt to include -fdebug-prefix-map instead (and then it
will not include -ffile-prefix-map).
the code from Vendor/Debian.pm does as follows:
# Avoid storing the build path in the binaries.
if ($flags->use_feature('reproducible', 'fixfilepath') or
$flags->use_feature('reproducible', 'fixdebugpath')) {
my $build_path = $flags->get_option_value('build-path');
my $map;
# -ffile-prefix-map is a superset of -fdebug-prefix-map, prefer it
# if both are set.
if ($flags->use_feature('reproducible', 'fixfilepath')) {
$map = '-ffile-prefix-map=' . $build_path . '=.';
} else {
$map = '-fdebug-prefix-map=' . $build_path . '=.';
}
$flags->append($_, $map) foreach @compile_flags;
}
Starting in 1.22.0ubuntu1, the Ubuntu vendor code *almost*
unconditionally adds -fdebug-prefix-map=OLD=NEW; it will avoid adding it
if it cannot parse version and source from debian/changelog. It will
also strip any existing -fdebug-prefix-map=. It will *not* strip -ffile-
prefix-map. It's not clear which would take precedence if both were
defined differently since -ffile-prefix-map is a superset of -fdebug-
prefix-map.
It also means dpkg-buildflags behavior changes depending on whether it
can parse a file ./debian/changelog and find version and source in it or
not.
That code is here:
} elsif (-r 'debian/changelog') {
require Dpkg::Changelog::Debian;
my $pkgchangelog = Dpkg::Changelog::Debian->new(range => { "count" => 1 });
$pkgchangelog->load('debian/changelog');
my $chgentry = @{$pkgchangelog}[0];
my $pkgver = $chgentry->get_version();
my $pkgsrc = $chgentry->get_source();
if ($pkgver ne "" && $pkgsrc ne "") {
my $debugprefixmap = '-fdebug-prefix-map=' . $build_path . '=/usr/src/' . $pkgsrc . '-' . $pkgver;
# Strip any existing -fdebug-prefix-map flag.
$flags->strip($_, $stripflag) foreach @compile_flags;
$flags->append($_, $debugprefixmap) foreach @compile_flags;
}
}
It *should* define -ffile-prefix-map *or* -fdebug-prefix-map based on
the same metric Debian uses, and strip all other instances of both.
** Affects: dpkg (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/2068653
Title:
dpkg-buildflags Ubuntu vendor module incompatible with Debaain
Status in dpkg package in Ubuntu:
New
Bug description:
Description: Ubuntu 24.04 LTS
Release: 24.04
dpkg:
Installed: 1.22.6ubuntu6
Candidate: 1.22.6ubuntu6
Version table:
*** 1.22.6ubuntu6 500
500 http://us.archive.ubuntu.com/ubuntu noble/main amd64 Packages
100 /var/lib/dpkg/status
expected: i expect dpkg-buildflags --get CFLAGS to include -ffile-
prefix-map=OLD=NEW by default.
observed: if run in a directory with a valid debian/changelog, dpkg-
buildflags --get CFLAGS includes both -ffile-prefix-map=OLD=NEW and
-fdebug-prefix-map=OLD=NEW. if run with no debian/changelog, it
behaves as expected.
analysis:
The Debian vendor module's "reproducible" support, which is what's
also documented by the reproducibility project, will include -ffile-
prefix-map=OLD=NEW (which is a superset of -fdebug-prefix-map=OLD=NEW)
unless you explicitly opt to include -fdebug-prefix-map instead (and
then it will not include -ffile-prefix-map).
the code from Vendor/Debian.pm does as follows:
# Avoid storing the build path in the binaries.
if ($flags->use_feature('reproducible', 'fixfilepath') or
$flags->use_feature('reproducible', 'fixdebugpath')) {
my $build_path = $flags->get_option_value('build-path');
my $map;
# -ffile-prefix-map is a superset of -fdebug-prefix-map, prefer it
# if both are set.
if ($flags->use_feature('reproducible', 'fixfilepath')) {
$map = '-ffile-prefix-map=' . $build_path . '=.';
} else {
$map = '-fdebug-prefix-map=' . $build_path . '=.';
}
$flags->append($_, $map) foreach @compile_flags;
}
Starting in 1.22.0ubuntu1, the Ubuntu vendor code *almost*
unconditionally adds -fdebug-prefix-map=OLD=NEW; it will avoid adding
it if it cannot parse version and source from debian/changelog. It
will also strip any existing -fdebug-prefix-map=. It will *not* strip
-ffile-prefix-map. It's not clear which would take precedence if both
were defined differently since -ffile-prefix-map is a superset of
-fdebug-prefix-map.
It also means dpkg-buildflags behavior changes depending on whether it
can parse a file ./debian/changelog and find version and source in it
or not.
That code is here:
} elsif (-r 'debian/changelog') {
require Dpkg::Changelog::Debian;
my $pkgchangelog = Dpkg::Changelog::Debian->new(range => { "count" => 1 });
$pkgchangelog->load('debian/changelog');
my $chgentry = @{$pkgchangelog}[0];
my $pkgver = $chgentry->get_version();
my $pkgsrc = $chgentry->get_source();
if ($pkgver ne "" && $pkgsrc ne "") {
my $debugprefixmap = '-fdebug-prefix-map=' . $build_path . '=/usr/src/' . $pkgsrc . '-' . $pkgver;
# Strip any existing -fdebug-prefix-map flag.
$flags->strip($_, $stripflag) foreach @compile_flags;
$flags->append($_, $debugprefixmap) foreach @compile_flags;
}
}
It *should* define -ffile-prefix-map *or* -fdebug-prefix-map based on
the same metric Debian uses, and strip all other instances of both.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/2068653/+subscriptions
More information about the foundations-bugs
mailing list