Patches required to compile LXC on ArchLinux with gcc-8


(Christian Brauner) #1

Hey everyone,

We’ve recently discovered that gcc-8 likes to complain (pointlessly about non-bugs) a lot when compiling LXC on ArchLinux. This breaks the build process. We have a set of patches that should fix this. They are all already backported to at least stable-3.0:

ccd42a31440f584a82bd8aa1f6e1b34bcc87e5b5 https://github.com/lxc/lxc/commit/ccd42a31440f584a82bd8aa1f6e1b34bcc87e5b5
d3bdf12cf00e93e3b1df354dd4cc46356baedf24 https://github.com/lxc/lxc/commit/d3bdf12cf00e93e3b1df354dd4cc46356baedf24
def4def6fd9df15dbb1f3ea107b92ab0ce96d909 https://github.com/lxc/lxc/commit/def4def6fd9df15dbb1f3ea107b92ab0ce96d909
095ead8051b58ec4a7aa89ad711daec15dff5f54 https://github.com/lxc/lxc/commit/095ead8051b58ec4a7aa89ad711daec15dff5f54
91c272a571d1e0f1c91fa37102fffdd3540514ce https://github.com/lxc/lxc/commit/91c272a571d1e0f1c91fa37102fffdd3540514ce
9de31d5a1394fd0bed495fa7cde5e625a1d64b48 https://github.com/lxc/lxc/commit/9de31d5a1394fd0bed495fa7cde5e625a1d64b48
2ec47d5149e73db97f7877d06d67cb11421097bb https://github.com/lxc/lxc/commit/2ec47d5149e73db97f7877d06d67cb11421097bb
50c6bb6b74d0414bc1b3bd5395b2bad6009a017d https://github.com/lxc/lxc/commit/50c6bb6b74d0414bc1b3bd5395b2bad6009a017d
d96a98469176ab6064583331cab9f002632a4586 https://github.com/lxc/lxc/commit/d96a98469176ab6064583331cab9f002632a4586

For developers please note that we have officially deprecated strncpy() from our codebase. It is replaced by a strlcpy() implementation that will be included automatically on systems using libcs that don’t provide an implementation. Our official coding style now states:

Use strlcpy() instead of strncpy()

When copying strings always use strlcpy() instead of strncpy(). The
advantage of strlcpy() is that it will always append a \0 byte to the
string.

Unless you have a valid reason to accept truncation you must check whether
truncation has occurred, treat it as an error, and handle the error
appropriately.

Thanks!
Christian