#1075720 authbind does not honor CFLAGS/LDFLAGS set by the maintainer

Package:
authbind
Source:
authbind
Description:
Allows non-root programs to bind() to low ports
Submitter:
Olivier Gayot
Date:
2024-12-06 18:30:01 UTC
Severity:
normal
Tags:
#1075720#5
Date:
2024-07-03 17:02:16 UTC
From:
To:
Dear Maintainer,

When building authbind, CFLAGS and LDFLAGS are overwritten by the
upstream makefile (and are also hardcoded in debian/rules). Therefore,
flags specified via dpkg-buildflags are ignored.

In Ubuntu, the attached patch was applied to enable frame-pointers and
enable LTO.

Thanks for considering the patch.

#1075720#10
Date:
2024-07-03 17:19:40 UTC
From:
To:
Hello,

I just noticed that my quilt patch does not automatically apply because authbind does not declare d/source/format.
As a consequence, the patch is ignored and the build still runs without the expected CFLAGS / LDFLAGS.

I will rework the patch and update.

Thanks,
Olivier

#1075720#15
Date:
2024-07-03 18:27:11 UTC
From:
To:
Dear Maintainer,

To avoid modifying the upstream makefile, I decided to pass the CFLAGS &
LDFLAGS variables on the CLI at the make invocation level.

Attaching the new debdiff.

Thanks,
Olivier

#1075720#20
Date:
2024-07-03 17:53:45 UTC
From:
To:
Olivier Gayot writes ("Bug#1075720: authbind does not honor CFLAGS/LDFLAGS set by the maintainer"):

Oh!  (I hadn't looked at it yet.)

Thanks.  Please don't change the package source format.  Just checking
that the patch works if it is actually applied will be fine.

Ian.

#1075720#25
Date:
2024-12-06 18:13:06 UTC
From:
To:
Hello,

I tried this form on top of the new debian upload.

I'm not sure what is preferred, since this is a debian native package.
I thought about only changing d/rules, but then I would break CPPFLAGS
because the one provided by dpkg-buildflags would not have the
MAJOR_VER and MINOR_VER defines. I ended up with the below, which I
think would still work as originally planned if you just run "make",
but also inherit the flags set by d/rules when building a package.

Please let me know what you think. I haven't run the new DEP8 test
yet. Once the builds are published in my ppa[1], I'll trigger the
autopkgtests.



1. https://launchpad.net/~ahasenack/+archive/ubuntu/authbind/+packages

#1075720#30
Date:
2024-12-06 18:26:52 UTC
From:
To:
Here are some build changes, on amd64.

Linking (the symbolic-functions one is an ubuntu delta in system-wide
build flags):
-cc -g  authbind.o   -o authbind
+cc -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro
 authbind.o   -o authbind
--- authbind.o.old 2024-12-06 15:17:06.648858576 -0300 +++ authbind.o.new 2024-12-06 15:16:57.902717367 -0300 @@ -3,18 +3,25 @@ authbind.o -c -DCONFIGDIR='"/etc/authbind"' +-D_FORTIFY_SOURCE=3 -D_GNU_SOURCE -DHELPER='"/usr/lib/authbind/helper"' -DLIBAUTHBIND='"/usr/lib/authbind/libauthbind.so.1"' -DMAJOR_VER='"1"' -DMINOR_VER='"0"' +-fcf-protection +-fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/authbind-2.2.0ubuntu1~ppa1 +-ffat-lto-objects +-ffile-prefix-map=/<<PKGBUILDDIR>>=. +-flto=auto +-fno-omit-frame-pointer +-fstack-clash-protection +-fstack-protector-strong -g +-mno-omit-leaf-frame-pointer -o --O2 --Wall --Wimplicit --Wmissing-prototypes --Wnested-externs --Wpointer-arith --Wstrict-prototypes --Wwrite-strings +-O3 +-Wdate-time +-Werror=format-security +-Werror=implicit-function-declaration +-Wformat Some of these may be ubuntu-specific, I haven't checked the debian build flags. But there are several changes of notice, like -Wall being dropped, _FORTIFY_SOURCE=3 in the case of ubuntu build flags, -O3, and other warning-specific flags. But I guess the question here is if we want the authbind package to adhere to the system-wide buildflags, and then perhaps have some overrides, or not. In the case of Ubuntu, this behavior was caught because we did a system-wide rebuild with frame-pointers enabled, and this was one of the packages we detected was not following the flags set by dpkg-buildflags. For reference, here is a dump of ubuntu's buildflags in plucky, the current devel release, run as the generic "ubuntu" user in a lxd plucky container: ASFLAGS= ASFLAGS_FOR_BUILD= CFLAGS=-g -O3 -Werror=implicit-function-declaration -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection CFLAGS_FOR_BUILD=-g -O3 -Werror=implicit-function-declaration -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=3 CPPFLAGS_FOR_BUILD=-Wdate-time -D_FORTIFY_SOURCE=3 CXXFLAGS=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection CXXFLAGS_FOR_BUILD=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection DFLAGS=-frelease DFLAGS_FOR_BUILD=-frelease FCFLAGS=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection FCFLAGS_FOR_BUILD=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection FFLAGS=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection FFLAGS_FOR_BUILD=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -fcf-protection LDFLAGS=-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro LDFLAGS_FOR_BUILD=-flto=auto -ffat-lto-objects -Wl,-z,relro OBJCFLAGS=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection OBJCFLAGS_FOR_BUILD=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection OBJCXXFLAGS=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection OBJCXXFLAGS_FOR_BUILD=-g -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/ubuntu=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection RUSTFLAGS=-Cforce-frame-pointers=yes RUSTFLAGS_FOR_BUILD=