On Thu, Jun 22, 2017 at 04:27:42AM -0400, Dengke Du wrote: > After gcc upgrade to 7.1, gcc7 contains a number of enhancements that help > detect buffer overflow and other forms of invalid memory accesses. > > When compiling lxc with gcc7, the system outputs errors: > > ../../../lxc-2.0.4/src/lxc/bdev/lxcloop.c:297:30: error: '%s' directive > output may be truncated writing up to 255 bytes into a region of size 95 > [-Werror=format-truncation=] > > This is because in configure.ac, the flag "-Werror" let the compiler treat > the warnings as errors, in order to compile successfully, we should add the > following to the configure.ac: > > -Wno-error=format-truncation
Hey there,
We are aware that LXC fails to compile with gcc7, but I don't believe we
should hide the error as this isn't an issue in our code but in gcc
itself.
The upstream gcc bug for this is:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78969
Stéphane
>
> Signed-off-by: Dengke Du <[email protected]>
> ---
> configure.ac | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index b9646d1..c03dc2c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -626,7 +626,7 @@ AC_PROG_SED
> LXC_CHECK_TLS
>
> if test "x$GCC" = "xyes"; then
> - CFLAGS="$CFLAGS -Wall -Werror"
> + CFLAGS="$CFLAGS -Wall -Werror -Wno-error=format-truncation"
> fi
>
> # Files requiring some variable expansion
> --
> 2.11.0
>
> _______________________________________________
> lxc-devel mailing list
> [email protected]
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
signature.asc
Description: PGP signature
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
