Bug 1084640 - GCC 8: open-iscsi build fails
GCC 8: open-iscsi build fails
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Lee Duncan
E-mail List
:
Depends on:
Blocks: 1084649
  Show dependency treegraph
 
Reported: 2018-03-09 10:04 UTC by Martin Liška
Modified: 2018-09-26 16:25 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
test patch for SUSE open-iscsi (1.92 KB, patch)
2018-03-21 22:11 UTC, Lee Duncan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2018-03-09 10:04:21 UTC
Build the package with GCC 8, there's error:

[   54s] sysfs.c:326:48: error: '/iscsi_host/' directive output may be truncated writing 12 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]

Please build the project as follows to reproduce the issue:
osc build --alternative-project=openSUSE:Factory:Staging:Gcc7
Comment 1 Lee Duncan 2018-03-16 14:31:52 UTC
I'll look at this
Comment 2 Lee Duncan 2018-03-21 21:59:46 UTC
The problem is that two strings get concatenated. One is a pathname, and one is that pathname plus "/iscsi_host/". The solution is to make sure there's room, and to make sure the compiler knows we've made sure by limiting the length of the string explicitly.

I will submit a patch upstream first but will also attach this upstream attempt, for reference.
Comment 3 Lee Duncan 2018-03-21 22:11:22 UTC
Created attachment 764522 [details]
test patch for SUSE open-iscsi

This patch is attached as a reference. I have already compile-tested it with gcc-8 and the default gcc (4.8.11?)
Comment 4 Lee Duncan 2018-03-22 02:11:25 UTC
Note: I found two other places in the code that generated comments from gcc-8, so I am fixing those as well. So please disregard the attachment, and see the "gcc-8-fixes" branch of github.com/gonzoleeman/open-iscsi

I've submitted a pull request to open-iscsi/open-iscsi as well.
Comment 5 Lee Duncan 2018-03-22 23:26:10 UTC
Now merged upstream, and submitted to Factory.

These changes will also filter to SLE-15/Leap-15 Update when the next fix needs to be merged, as I assume those releases will not be jumping to gcc-8 any time soon.

Correct?
Comment 6 Martin Liška 2018-03-27 09:08:23 UTC
SLE-15 will remain with GCC 7.x branch. But it would be nice to have the fixes for open-iscsi in SLE-15. It's a possible issue.
Thanks for the fix.
Comment 7 Martin Liška 2018-03-27 15:38:40 UTC
The package update landed to Factory, but I still can see the failure:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/open-iscsi/standard/x86_64

I double checked that by building the package locally.
Comment 8 Lee Duncan 2018-04-02 22:05:50 UTC
(In reply to Martin Liška from comment #7)
> The package update landed to Factory, but I still can see the failure:
> https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:
> Gcc7/open-iscsi/standard/x86_64
> 
> I double checked that by building the package locally.

That is still the old code.

The error message is complaining about this line in libopeniscsiusr/sysfs.c:

> [   44s] sysfs.c: In function '_iscsi_host_id_of_session':
> [   44s] sysfs.c:326:48: error: '/iscsi_host/' directive output may be truncated writing 12 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
> [   44s]   snprintf(sys_scsi_host_dir_path, PATH_MAX, "%s/iscsi_host/",
> [   44s]                                                 ^~~~~~~~~~~~
> [   44s] In file included from /usr/include/stdio.h:862,
> [   44s]                  from sysfs.c:22:
> [   44s] /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 4108 bytes into a destination of size 4096
> [   44s]    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> [   44s]           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [   44s]         __bos (__s), __fmt, __va_arg_pack ());
> [   44s]         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But that code has been changed is now looks like:

>         strncpy(sys_scsi_host_dir_path, sys_dev_path, PATH_MAX);
>         strncat(sys_scsi_host_dir_path, iscsi_host_dir_str,
>                 PATH_MAX - iscsi_host_dir_strlen);

So you need to trigger a rebuild?
Comment 9 Lee Duncan 2018-04-02 22:21:46 UTC
Factory open-iscsi submitted to SLE-15, but probably won't make GA?

Note that open-iscsi sources are the same for SLE-15:GA and for Factory at this time.
Comment 11 Martin Liška 2018-04-03 07:40:55 UTC
I can confirm that Factory version is fine. There must be some broken link in OBS.
Thanks for the fix.
Comment 12 Lee Duncan 2018-04-03 18:41:39 UTC
It looks like this was accepted into SLE-15:GA, so marking it as resolved.