Closed
Description
getconf HOST_NAME_MAX
255
but could potentially be larger, see https://stackoverflow.com/questions/8724954/what-is-the-maximum-number-of-characters-for-a-host-name-in-unix
While the POSIX standard says it is guaranteed not to exceed 255 bytes, that does not necessarily mean that each implementation will adhere to that.
Example
change const size = 64
to const size = 5
(for eg) then run:
nim r --lib:lib --eval:'import nativesockets; echo getHostname()'
Current Output
shows my hostname truncated to 4 chars, and no error
Expected Output
don't truncate, or at least raise
Possible Solution
var buf {.noinit.}: array[256, char]
etc
Additional Information
1.5.1 7f077a7