Description
Description
This will create a socket file named "hell"
import std/net
let sock = newSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP)
sock.bindUnix("hello")
Nim Version
Nim Compiler Version 1.6.18 [OpenBSD: amd64]
Compiled at 2024-03-17
Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
Current Output
$ ls h*
hell
Expected Output
$ ls h*
hello
Possible Solution
I'm guessing there is some issue with null terminated strings. Linux man pages mentions a historical issue here:
In addition, some implementations don't require a null terminator
when binding a socket (the addrlen argument is used to determine
the length of sun_path) and when the socket address is retrieved
on these implementations, there is no null terminator in
sun_path.
https://man7.org/linux/man-pages/man7/unix.7.html
Additional Information
Works fine in Ubuntu 22.04 / Nim 1.6.14
Broken in amd64 OpenBSD 7.3 / Nim 1.6.6
Broken in amd64 OpenBSD 7.4 / Nim 1.6.14
Broken in amd64 OpenBSD 7.5 / Nim 1.6.18
Broken in amd64 OpenBSD 7.5 / Nim 2.0.8