Public bug reported:

Ubuntu's dpkg-buildflags adds the ELF package metadata to the default
LDFLAGS (qa feature "elfpackagemetadata", enabled by default):

  -Wl,--package-
metadata=%7B%22type%22:%22deb%22%2C%22os%22:%22ubuntu%22%2C...%7D

The value contains both '%' (percent-encoding) and ':' (raw, between
JSON keys and values). Several older build systems paste LDFLAGS into
generated sed scripts using '%' or ':' as the s/// separator, which then
fail with "unknown option to `s'". These all build fine in Debian, which
doesn't add the flag.

Packages currently stuck in stonking-proposed because of this:

1. bsdgames-nonfree 2.17-10build1 (~250 days, all architectures)
   configure writes "s%@var@%$value%g" lines into subst.sed; debian/rules 
passes $(LDFLAGS) as bsd_games_cfg_other_ldflags.
     sed: file subst.sed line 49: unknown option to `s'
   
https://launchpad.net/ubuntu/+source/bsdgames-nonfree/2.17-10build1/+build/32793388

2. fdclone 3.01j-1.1build1 (all architectures except riscv64)
   mkmfsed.c prints "s:__VAR__:value:" rules into mkmf.sed, including the 
LDFLAGS passed by debian/rules.
     sed: file mkmf.sed line 37: unknown option to `s'
   https://launchpad.net/ubuntu/+source/fdclone/3.01j-1.1build1/+build/32793424

3. mairix 0.24-2build1: configure uses sed "s%...%${LDFLAGS}%" (separate bug 
#2170632)
   https://launchpad.net/ubuntu/+source/mairix/0.24-2build1/+build/32793505

4. clustalx 2.1+lgpl-9build3: debian/rules uses sed "s:LFLAGS *= .*:& 
$(LDFLAGS):" (separate bug #2170698)
   
https://launchpad.net/ubuntu/+source/clustalx/2.1+lgpl-9build3/+build/32793397

Already worked around: bsdgames 2.17-35ubuntu1 (same configure as
bsdgames-nonfree) sets "qa=-elfpackagemetadata" in
DEB_BUILD_MAINT_OPTIONS.

Found by scanning the failed build logs of all 142 sources with missing
builds in the stonking excuses (2026-10-12); other packages may be hit
in ways the log patterns didn't catch.

This is separate from bug #2170637 (linkers or targets that can't take
the option or the note at all): here the option is fine, only its value
trips up text processing.

Fix options:
- dpkg: avoid characters commonly used as sed separators in the value. The ':' 
could be percent-encoded too (%3A), but '%' itself is needed by the encoding, 
so this can only reduce the problem, not remove it. Documenting the issue and 
the opt-out may be the realistic outcome.
- Per package (works for all of the above, since only the LDFLAGS value is 
involved, not the ELF_PACKAGE_METADATA environment variable):
    export DEB_BUILD_MAINT_OPTIONS += qa=-elfpackagemetadata
  or switch the sed separator to a character that can't appear in flags.

** Affects: bsdgames-nonfree (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: dpkg (Ubuntu)
     Importance: Undecided
     Assignee: Benjamin Drung (bdrung)
         Status: New

** Affects: fdclone (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: ftbfs update-excuse

** Tags added: update-excuse

** Tags added: ftbfs

** Changed in: dpkg (Ubuntu)
     Assignee: (unassigned) => Benjamin Drung (bdrung)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170756

Title:
  dpkg-buildflags: '%' and ':' in --package-metadata LDFLAGS break sed-
  based build systems (bsdgames-nonfree, fdclone, mairix, clustalx)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bsdgames-nonfree/+bug/2170756/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to