Bug#1150410: pyfftw: d/p/hardening passes LDFLAGS as a single argument, breaking multi-flag LDFLAGS
Sebastien Bacher
seb128 at ubuntu.com
Fri Oct 9 11:06:11 BST 2026
Source: pyfftw
Version: 0.15.0-1.1
Severity: normal
Tags: patch
X-Debbugs-Cc: seb128 at ubuntu.com
Hi,
debian/patches/hardening passes LDFLAGS to the feature-detection link
checks in setup.py as a single argument:
self.linker_flags = [os.environ.get("LDFLAGS")]
With Debian's default LDFLAGS ("-Wl,-z,relro") that happens to work,
because it is a single flag. As soon as LDFLAGS contains more than one
flag, the linker gets them as one bogus option, every check fails, and
the build stops with a misleading error. In Ubuntu:
ld.bfd: unrecognized option '-Bsymbolic-functions -Wl'
collect2: error: ld returned 1 exit status
error: Could not find the FFTW header 'fftw3.h'
The same would happen in Debian with any extra flag in LDFLAGS (for
example DEB_LDFLAGS_MAINT_APPEND or a local hardening setting). When
LDFLAGS is unset it also passes None to the linker call.
The attached updated patch splits the variable with shlex:
self.linker_flags = shlex.split(os.environ.get("LDFLAGS", ""))
With it, pyfftw builds in Ubuntu and the test suite passes (1720 passed,
86 skipped), with single, double and long double support detected. With
Debian's LDFLAGS the behaviour is unchanged.
Regards,
Sebastien
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-38-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
From: Michael R. Crusoe <crusoe at debian.org>
Subject: respect LDFLAGS
Description: Pass LDFLAGS to the feature-detection link checks
Split LDFLAGS into separate arguments with shlex. Passing the whole
string as one argument breaks as soon as LDFLAGS has more than one
flag (e.g. Ubuntu's "-Wl,-Bsymbolic-functions ... -Wl,-z,relro"): the
linker rejects it, every check fails and the build stops with
"Could not find the FFTW header 'fftw3.h'". It also passed None when
LDFLAGS was unset.
Last-Update: 2026-10-09
Index: pyfftw-0.15.0/setup.py
===================================================================
--- pyfftw-0.15.0.orig/setup.py
+++ pyfftw-0.15.0/setup.py
@@ -47,6 +47,7 @@ from sysconfig import get_platform
from contextlib import redirect_stderr, redirect_stdout
import os
+import shlex
import logging
import platform
import sys
@@ -172,7 +173,7 @@ class EnvironmentSniffer(object):
self.objects = []
self.libraries = []
self.library_dirs = get_library_dirs()
- self.linker_flags = []
+ self.linker_flags = shlex.split(os.environ.get("LDFLAGS", ""))
self.compile_time_env = {}
if self.compiler.compiler_type == 'msvc':
More information about the debian-science-maintainers
mailing list