Artful: Fix FTBS on test-rebuild-20170922

Bug #1723055 reported by Stefan Bader
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tgt (Ubuntu)
Fix Released
High
Unassigned
Artful
Fix Released
Undecided
Unassigned

Bug Description

Build fails because gcc detects using an incorrect length (16 instead of 8) when doing an sprintf for vendor_id.

spc.c: In function ‘spc_lu_init’:
spc.c:2072:5: error: ‘%-16s’ directive output truncated writing 16 bytes into a region of size 9 [-Werror=format-truncation=]
    "%-16s", VENDOR_ID);
     ^~~~~
In file included from /usr/include/stdio.h:862:0,
                 from spc.c:24:
/usr/include/i386-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 17 bytes into a destination of size 9
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Revision history for this message
Stefan Bader (smb) wrote :

Additional issues:

smc.c: In function ‘build_element_descriptors’:
smc.c:164:41: error: ‘__builtin___snprintf_chk’ output truncated before the last format character [-Werror=format-truncation=]
    snprintf((char *)&data[i], 32, "%-32s", s->volume_tag);
                                         ^
In file included from /usr/include/stdio.h:862:0,
                 from smc.c:32:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 33 bytes into a destination of size 32
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
smc.c:166:41: error: ‘__builtin___snprintf_chk’ output truncated before the last format character [-Werror=format-truncation=]
    snprintf((char *)&data[i], 32, "%-32s", s->barcode);
                                         ^
In file included from /usr/include/stdio.h:862:0,
                 from smc.c:32:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 33 bytes into a destination of size 32
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I believe the size of the volume_tag element should be increased to 33 bytes.

smc.c:184:40: error: ‘%-10s’ directive output may be truncated writing between 10 and 36 bytes into a region of size 11 [-Werror=format-truncation=]
   snprintf((char *)&data[i + 28], 11, "%-10s", attr->scsi_sn);
                                        ^~~~~
In file included from /usr/include/stdio.h:862:0,
                 from smc.c:32:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 11 and 37 bytes into a destination of size 11
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scsi_sn is defined as 36 bytes long (+1 byte for termination). Question is whether truncation here would be accidental or desired...

Revision history for this message
Stefan Bader (smb) wrote :
tags: added: patch
Stefan Bader (smb)
tags: added: ftbs
Andy Whitcroft (apw)
tags: added: ftbfs
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

In fact all of the fixes are upstream and I just built fine from a ppa backporting "the official" changes. I pinged smb to discuss who will upload what.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ok, there is nothing sponsored yet - I'll provide the fix to review soon.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Fix confirmed working in [1], now cleaning up branches for review.

[1]: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/2999/+packages

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Changes reviewed and uploading for Artful.
This might race with BB opening and then needs another version (actually the version is fine but it needs to be B... then, and artful get an SRU version number).
Please let me know if it collides, otherwise this should easily go in before without issues.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Stefan, or anyone else affected,

Accepted tgt into artful-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tgt/1:1.0.71-1ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-artful to verification-done-artful. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-artful. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in tgt (Ubuntu Artful):
status: New → Fix Committed
tags: added: verification-needed verification-needed-artful
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Builds fine now, no further breakage seen.
The dep8 test sof tgt and iscsi are good to test and they seem still happy as well - so set verified.

tags: added: verification-done verification-done-artful
removed: verification-needed verification-needed-artful
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tgt - 1:1.0.71-1ubuntu2

---------------
tgt (1:1.0.71-1ubuntu2) artful; urgency=medium

  * Fix FTBFS with gcc7 by backporting upstream patches (LP: #1723055)
    - d/p/GCC-FTBFS-1-Fix-header-warning-with-GCC-7-for-major.patch
    - d/p/GCC-FTBFS-2-Remove-incorrect-size-specifier-in-spc_lu_init.patch
    - d/p/GCC-FTBFS-3-smc-fix-snprintf-warnings-with-gcc7.patch
    - Those patches are unchanged from upstream and make tgt effectively
      almost 1.0.72, so on that merge they can be dropped.

 -- Christian Ehrhardt <email address hidden> Thu, 19 Oct 2017 14:55:37 +0200

Changed in tgt (Ubuntu Artful):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for tgt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This was hanging in bionic proposed due to open-iscsi missing an image.
That is now ok (image is available), also we said drop changes on next merge - so merging the latest release now.

Changed in tgt (Ubuntu):
assignee: Stefan Bader (smb) → nobody
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tgt - 1:1.0.71-1ubuntu2

---------------
tgt (1:1.0.71-1ubuntu2) artful; urgency=medium

  * Fix FTBFS with gcc7 by backporting upstream patches (LP: #1723055)
    - d/p/GCC-FTBFS-1-Fix-header-warning-with-GCC-7-for-major.patch
    - d/p/GCC-FTBFS-2-Remove-incorrect-size-specifier-in-spc_lu_init.patch
    - d/p/GCC-FTBFS-3-smc-fix-snprintf-warnings-with-gcc7.patch
    - Those patches are unchanged from upstream and make tgt effectively
      almost 1.0.72, so on that merge they can be dropped.

 -- Christian Ehrhardt <email address hidden> Thu, 19 Oct 2017 14:55:37 +0200

Changed in tgt (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

For now the one in propose will pass as now an image for bionic is there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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