Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20.8.1] Build fails uisng gcc 9.3.1 #440

Closed
tuxmaster5000 opened this issue Feb 8, 2021 · 3 comments
Closed

[20.8.1] Build fails uisng gcc 9.3.1 #440

tuxmaster5000 opened this issue Feb 8, 2021 · 3 comments
Labels

Comments

@tuxmaster5000
Copy link
Contributor

When I try to build the lib using gcc 9.3.1 then the build fails with:

make[2]: Leaving directory /builddir/build/BUILD/gvm-libs-20.8.1' [ 90%] Built target gvm_boreas_shared In file included from /usr/include/string.h:638, from /usr/include/glib-2.0/glib/gtestutils.h:30, from /usr/include/glib-2.0/glib.h:82, from /builddir/build/BUILD/gvm-libs-20.8.1/base/settings.h:30, from /builddir/build/BUILD/gvm-libs-20.8.1/base/prefs.c:28: In function 'strncpy', inlined from 'prefs_config' at /builddir/build/BUILD/gvm-libs-20.8.1/base/prefs.c:155:3: /usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' specified bound 2048 equals destination size [-Werror=stringop-truncation] 120 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [base/CMakeFiles/gvm_base_shared.dir/prefs.c.o] Error 1 make[2]: Leaving directory /builddir/build/BUILD/gvm-libs-20.8.1'
make[1]: *** [base/CMakeFiles/gvm_base_shared.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from /usr/include/string.h:638,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:82,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/../base/nvti.h:30,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.h:28,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:27:
In function 'strncpy',
inlined from 'redis_direct_conn' at /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:429:3:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
120 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c: In function 'redis_direct_conn':
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:429:3: note: length computed here
429 | strncpy (kbr->path, kb_path, strlen (kb_path));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:638,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:82,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/../base/nvti.h:30,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.h:28,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:27:
In function 'strncpy',
inlined from 'redis_new' at /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:396:3:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
120 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c: In function 'redis_new':
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:396:3: note: length computed here
396 | strncpy (kbr->path, kb_path, strlen (kb_path));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:638,
from /usr/include/glib-2.0/glib/gtestutils.h:30,
from /usr/include/glib-2.0/glib.h:82,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/../base/nvti.h:30,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.h:28,
from /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:27:
In function 'strncpy',
inlined from 'redis_find' at /builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:471:3:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
120 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c: In function 'redis_find':
/builddir/build/BUILD/gvm-libs-20.8.1/util/kb.c:471:3: note: length computed here
471 | strncpy (kbr->path, kb_path, strlen (kb_path));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: Leaving directory /builddir/build/BUILD/gvm-libs-20.8.1' make[1]: Leaving directory /builddir/build/BUILD/gvm-libs-20.8.1'

OS: CentOS7

@y0urself
Copy link
Member

y0urself commented Feb 8, 2021

It would be more readable if you use ```bash ``` instead of > quote the output. :)

@tuxmaster5000
Copy link
Contributor Author

When the code is safe, then the prama can used.
But for during this, my knowledge of the source code are to bad.
Sample:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (buffer, config, sizeof (buffer));
#pragma GCC diagnostic pop

@tuxmaster5000
Copy link
Contributor Author

I will create an PR with an fix for it. But some with deep knowledge of the code must review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants