[pkg-opensc-maint] Bug#1010461: opensc: Workaround for build failure when using -O3
Steve Langasek
steve.langasek at canonical.com
Mon May 2 03:07:11 BST 2022
Package: opensc
Version: 0.22.0-2
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch
Hi Eric,
In Ubuntu, opensc was failing to build on ppc64el because we build using -O3
by default and the compiler when running at a higher optimization level was
detecting an overflow:
[...]
/bin/bash ../../libtool --tag=CC --tag CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -D'OPENSC_CONF_PATH="/etc/opensc/opensc.conf"' -D'DEFAULT_SM_MODULE_PATH="/usr/lib/powerpc64le-linux-gnu"' -D'DEFAULT_SM_MODULE="libsmm-local.so"' -I../../src -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/PCSC -Wall -Wextra -Wno-unused-parameter -Werror -Wstrict-aliasing=2 -g -O3 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wno-error=deprecated-declarations -Wno-error=maybe-uninitialized -c -o libopensc_la-card-starcos.lo `test -f 'card-starcos.c' || echo './'`card-starcos.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -DOPENSC_CONF_PATH=\"/etc/opensc/opensc.conf\" -DDEFAULT_SM_MODULE_PATH=\"/usr/lib/powerpc64le-linux-gnu\" -DDEFAULT_SM_MODULE=\"libsmm-local.so\" -I../../src -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/PCSC -Wall -Wextra -Wno-unused-parameter -Werror -Wstrict-aliasing=2 -g -O3 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wno-error=deprecated-declarations -Wno-error=maybe-uninitialized -c card-starcos.c -fPIC -DPIC -o .libs/libopensc_la-card-starcos.o
[...]
In function ‘starcos_select_aid’,
inlined from ‘starcos_select_file’ at card-starcos.c:868:11:
card-starcos.c:674:39: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
674 | file->name[i] = aid[i];
| ~~~~~~~~~~~~~~^~~~~~~~
In file included from ../../src/libopensc/opensc.h:42,
from asn1.h:28,
from card-starcos.c:29:
card-starcos.c: In function ‘starcos_select_file’:
../../src/libopensc/types.h:251:23: note: at offset 16 into destination object ‘name’ of size 16
251 | unsigned char name[16]; /* DF name */
| ^~~~
[...]
(https://launchpad.net/ubuntu/+source/opensc/0.22.0-1ubuntu1/+build/22603195)
As far as I can tell this is a spurious error because the 'len' argument
could in practice never be greater than 16, so I worked around this by
suppressing -Werror=stringop-overflow as in the attached patch.
Since Debian doesn't ever build with -O3 by default, this is definitely a
low-priority issue.
Thanks for considering,
--
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/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
diff -Nru opensc-0.22.0/debian/rules opensc-0.22.0/debian/rules
--- opensc-0.22.0/debian/rules 2022-01-31 07:02:55.000000000 +0100
+++ opensc-0.22.0/debian/rules 2022-05-02 03:49:53.000000000 +0200
@@ -1,7 +1,7 @@
#!/usr/bin/make -f
export DEB_CFLAGS_MAINT_APPEND = -Wno-error=deprecated-declarations \
- -Wno-error=maybe-uninitialized
+ -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow
%:
dh $@
More information about the pkg-opensc-maint
mailing list