Strlcpy/strlcat missing in core-snap

strlcpy/strlcat are undefined in libc library in core16/core18, Do we have to implement the two functions by ourself when using snapcraft ? There are many opensoure software depending on the two functions, it’s so inconvenient if missing them within basic libraries of core-snap.

The core and core18 snaps both ship the standard GNU libc that you find on virtually all Linux systems. It is very unlikely that we’ll switch to a separate C library just for snaps.

The main arguments against including those functions is that they just replace one problem (undefined behaviour on buffer overrun) with another problem (string truncation). This article describes some of the history:

https://lwn.net/Articles/612244/

If your code depends on strlcpy, you could try using libbsd – a library containing implementations of a number of non-standard functions originating from BSD.

1 Like