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 utils: account for terminating \0 byte · lxc/lxc@ccd42a3 · GitHub
d3bdf12cf00e93e3b1df354dd4cc46356baedf24 confile: satisfy gcc-8 · lxc/lxc@d3bdf12 · GitHub
def4def6fd9df15dbb1f3ea107b92ab0ce96d909 network: silence gcc-8 · lxc/lxc@def4def · GitHub
095ead8051b58ec4a7aa89ad711daec15dff5f54 network: adhere to IFNAMSIZ limit · lxc/lxc@095ead8 · GitHub
91c272a571d1e0f1c91fa37102fffdd3540514ce strlcpy: add strlcpy() implementation · lxc/lxc@91c272a · GitHub
9de31d5a1394fd0bed495fa7cde5e625a1d64b48 tree-wide: s/strncpy()/strlcpy()/g · lxc/lxc@9de31d5 · GitHub
2ec47d5149e73db97f7877d06d67cb11421097bb tools: s/strncpy()/strlcpy()/g · lxc/lxc@2ec47d5 · GitHub
50c6bb6b74d0414bc1b3bd5395b2bad6009a017d Revert "tools: s/strncpy()/strlcpy()/g" · lxc/lxc@50c6bb6 · GitHub
d96a98469176ab6064583331cab9f002632a4586 tools: s/strncpy()/memcpy()/ · lxc/lxc@d96a984 · GitHub
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