#1133272 dpkg-buildflags: Document that getconf for LFS must not be used

Package:
dpkg-dev
Source:
dpkg-dev
Submitter:
Martin-Éric Racine
Date:
2026-04-12 04:57:01 UTC
Severity:
normal
Tags:
#1133272#5
Date:
2026-04-11 10:46:06 UTC
From:
To:
In my packages, I currently have to manually include the following in debian/rules:

export DEB_CFLAGS_MAINT_APPEND  +=$(shell getconf LFS_CFLAGS) $(HARDENING_CFLAGS)
export DEB_LDFLAGS_MAINT_APPEND +=$(shell getconf LFS_LDFLAGS) $(HARDENING_LDFLAGS)

It would be nice if dpkg-buildflags provided these for us.

Thanks!
Martin-Éric

#1133272#10
Date:
2026-04-11 11:03:09 UTC
From:
To:
Hi!

The getconf interface is problematic as it does not correctly support
cross-building. I clarified this in the lintian tag for the LFS
support with:

https://salsa.debian.org/lintian/lintian/-/commit/ba9c7fd96801e3c796d0233b4f7432e55dffe057

but now that the lintian LFS tag has been removed, that got lost.

In any case, dpkg-buildflags already supports setting LFS flags with:

  export DEB_BUILD_MAINT_OPTIONS = abi=+lfs

which should support cross-building correctly.

I was going to close this report as invalid, but I guess I can instead
document that the getconf interface should not be used in the
dpkg-buildflags man page (although I'm not sure it would have helped
here, as I assume the man page was not checked?).

Thanks,
Guillem

#1133272#19
Date:
2026-04-11 12:02:59 UTC
From:
To:
la 11.4.2026 klo 14.03 Guillem Jover (guillem@debian.org) kirjoitti:

Noted.

I simply typed 'dpkg-buildflags' onto the command line and did not see
LFS_CFLAGS or LFS_LDFLAGS among the results, so I filed this bug.

Martin-Éric

#1133272#22
Date:
2026-04-11 18:59:33 UTC
From:
To:
Hi!

Bug #1133272 in package dpkg reported by you has been fixed in
the dpkg/dpkg.git Git repository. You can see the changelog below, and
you can check the diff of the fix at:

https://git.dpkg.org/cgit/dpkg/dpkg.git/diff/?id=006112209
---
man: Document that getconf(1) must not be used for LFS support

This interface does not support cross-building, and dpkg-buildflags
already has native support to support LFS.

Closes: #1133272

#1133272#29
Date:
2026-04-12 04:54:01 UTC
From:
To:
la 11.4.2026 klo 22.07 Guillem Jover (guillem@debian.org) kirjoitti:

Thanks. I'm not sure that the above really helps. All it says is not
to call getconf for LFS_CFLAGS or LFS_LDFLAGS. It doesn't tell what's
the proper way of setting them via dpkg-buildflags. What is does say
is that using 'abi=+lfs' will append '-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64' to CPPFLAGS, which clearly isn't the same
thing. It might indeed accomplish the same result, but that really
isn't clear in the manual page.

Martin-Éric

Martin-Éric