Package: libeconf
Version: 0.4.4+dfsg1-1
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch

Hi Andreas,

libeconf is failing to build in Ubuntu with a format string error from gcc:

[...]
cc -Ieconftool.p -I. -I.. -I../include -fdiagnostics-color=always 
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -O0 
-D_GNU_SOURCE=1 -DXTSTRINGDEFINES -Werror -fstack-protector-strong 
-funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection 
-Werror=return-type -flto=8 -Wbad-function-cast -Wcast-align -Wcast-qual 
-Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow 
-Wstrict-prototypes -Wundef -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. 
-flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -fPIE -MD -MQ econftool.p/util_econftool.c.o -MF 
econftool.p/util_econftool.c.o.d -o econftool.p/util_econftool.c.o -c 
../util/econftool.c
../util/econftool.c: In function ‘main’:
../util/econftool.c:591:84: error: ‘__snprintf_chk’ output may be truncated 
before the last format character [-Werror=format-truncation=]
  591 |     snprintf(conf_basename, strlen(argv[optind + 1]) - 
strlen(conf_suffix) + 1, "%s", argv[optind + 1]);
      |                                                                         
           ^
[...]

  (https://launchpad.net/ubuntu/+source/libeconf/0.4.4+dfsg1-1/+build/23574046)

I've looked over the code and I think there's no real problem with what the
code's doing, it's just defying gcc's static analysis for format-truncation.

To get the package building in Ubuntu, rather than refactoring the code to
make gcc happy, I've suppressed the warning as in the attached patch.

This build failure doesn't currently affect Debian, so I've marked this bug
report severity 'minor'; but I expect at some point this will start to
affect Debian as well, possibly when glibc is updated to 2.34.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru libeconf-0.4.4+dfsg1/debian/rules libeconf-0.4.4+dfsg1/debian/rules
--- libeconf-0.4.4+dfsg1/debian/rules   2022-02-05 14:15:28.000000000 -0800
+++ libeconf-0.4.4+dfsg1/debian/rules   2022-07-08 08:41:11.000000000 -0700
@@ -13,6 +13,7 @@
 # package maintainers to append LDFLAGS
 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+export DEB_CFLAGS_MAINT_APPEND = -Wno-error=format-truncation
 
 %:
        dh $@ --buildsystem=meson

Reply via email to