mir: build failure on s390x

Bug #1889166 reported by Gianfranco Costamagna
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mir (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hello, looks like we are missing one "+1" from somewhere, but I don't have enough knowledge on this code... can you please have a look? in the meanwhile I'm probably going to disable that error

cd /<<PKGBUILDDIR>>/build-s390x/src/miral && /usr/bin/cc -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DEGL_NO_X11 -DLOG_NDEBUG=1 -DLTTNG_UST_HAVE_SDT_INTEGRATION -DMESA_EGL_NO_X11_HEADERS -DMIR_DRMMODEADDFB_HAS_CONST_SIGNATURE -DMIR_LOG_COMPONENT_FALLBACK=\"miral\" -DMIR_SERVER_EGL_OPENGL_API=EGL_OPENGL_ES_API -DMIR_SERVER_EGL_OPENGL_BIT=EGL_OPENGL_ES2_BIT -DMIR_SERVER_GLEXT_H="<GLES2/gl2ext.h>" -DMIR_SERVER_GL_H="<GLES2/gl2.h>" -DMIR_VERSION_MAJOR=1 -DMIR_VERSION_MICRO=1 -DMIR_VERSION_MINOR=7 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_GNU_SOURCE -I/<<PKGBUILDDIR>>/include/core -I/<<PKGBUILDDIR>>/include/common -I/<<PKGBUILDDIR>>/include/cookie -I/<<PKGBUILDDIR>>/src/include/common -I/<<PKGBUILDDIR>>/build-s390x/src/capnproto -I/<<PKGBUILDDIR>>/build-s390x/src/protobuf -I/<<PKGBUILDDIR>>/include/platform -I/<<PKGBUILDDIR>>/include/client -I/<<PKGBUILDDIR>>/include/server -I/<<PKGBUILDDIR>>/src/include/platform -I/<<PKGBUILDDIR>>/include/miral -I/usr/include/uuid -I/<<PKGBUILDDIR>>/include/wayland -I/<<PKGBUILDDIR>>/src/wayland/generated -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -g -Wall -pedantic -Wextra -fPIC -Werror -flto -ffat-lto-objects -fvisibility=hidden -pthread -o CMakeFiles/miral-internal.dir/xcursor.c.o -c /<<PKGBUILDDIR>>/src/miral/xcursor.c
In file included from /usr/include/string.h:495,
                 from /<<PKGBUILDDIR>>/src/miral/xcursor.c:26:
In function ‘strncpy’,
    inlined from ‘_XcursorAddPathElt’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:647:5,
    inlined from ‘_XcursorBuildFullname’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:726:5,
    inlined from ‘xcursor_load_theme’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:875:10:
/usr/include/s390x-linux-gnu/bits/string_fortified.h:106:10: error: ‘strncpy’ output truncated before terminating nul copying 7 bytes from a string of the same length [-Werror=stringop-truncation]
  106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘_XcursorAddPathElt’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:647:5,
    inlined from ‘_XcursorBuildFullname’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:727:5,
    inlined from ‘xcursor_load_theme’ at /<<PKGBUILDDIR>>/src/miral/xcursor.c:884:11:
/usr/include/s390x-linux-gnu/bits/string_fortified.h:106:10: error: ‘strncpy’ output truncated before terminating nul copying 11 bytes from a string of the same length [-Werror=stringop-truncation]
  106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [src/miral/CMakeFiles/miral-internal.dir/build.make:183: src/miral/CMakeFiles/miral-internal.dir/xcursor.c.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Tags: ftbfs
tags: added: ftbfs
description: updated
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Looking at the code, it is written correctly and handles the case where strncpy() "truncates before the terminating nul". It is unfortunate that this triggers a warning.

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Yep, I created a minimal test case on my laptop, and couldn't figure out why there was this warning in first place.
At the end, I ended up in something like this:
http://launchpadlibrarian.net/490452795/mir_1.7.1-0ubuntu6_1.7.1-0ubuntu7.diff.gz

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

I'm not closing this bug, because overriding the build flag is not a fix...

Revision history for this message
Chris Halse Rogers (raof) wrote :

While it's true this won't result in an unterminated char*, I think (but am not sure) that it *is* a logic bug. Because it will be truncating the string by overwriting the final (non-null) character with null?

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

@raof this is probably true if the path is long, but I can't figure out how to patch it...

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

In src/miral/CMakeLists.txt

Change:

    set_source_files_properties(xcursor.c PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE)

to

    set_source_files_properties(xcursor.c PROPERTIES
        COMPILE_DEFINITIONS _GNU_SOURCE
        COMPILE_FLAGS "-Wno-error=stringop-truncation"
    )

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mir - 2.2.0-0ubuntu2

---------------
mir (2.2.0-0ubuntu2) hirsute; urgency=medium

  * debian/patches/disable-stringop-truncation.patch:
    - Disable -Werror=stringop-truncation on imported xcursor.c file. This
      trggers on s390x (and only s390x?), but the code appears safe.
      Fixes FTBFS on s390x (LP: #1889166)
  * debian/patches/increase-display-test-timeout.patch:
    - Standardise test timeouts to 60s (increased from 10s) in the
      DisplayConfiguratonTest acceptance tests. These inconsistently fail on
      the Launchpad builders on slow architectures (notably arm64 and armhf).

 -- Christopher James Halse Rogers <email address hidden> Thu, 17 Dec 2020 10:44:50 +1100

Changed in mir (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.