pkg/60039: lua54-socket-3.1.0 fails to build

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.bugs
Message-ID <[email protected]>
>Number:         60039
>Category:       pkg
>Synopsis:       lua54-socket-3.1.0 fails to build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 26 09:25:00 +0000 2026
>Originator:     nico
>Release:        pkgsrc-2025Q4
>Organization:
rintene.trade
>Environment:
SunOS briareus 5.11 joyent_20251113T010957Z i86pc i386 i86pc
>Description:
On SunOS lua-socket fails to build with following error: 
unixstream.c: In function 'unixstream_trybind':
unixstream.c:193:10: error: 'struct sockaddr_un' has no member named 'sun_len'
  193 |     local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len)
      |          ^
unixstream.c:193:60: error: 'struct sockaddr_un' has no member named 'sun_len'
  193 |     local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len)
      |                                                            ^
unixstream.c:195:54: error: 'struct sockaddr_un' has no member named 'sun_len'
  195 |     err = socket_bind(&un->sock, (SA *) &local, local.sun_len);
      |                                                      ^
unixstream.c: In function 'unixstream_tryconnect':
unixstream.c:248:11: error: 'struct sockaddr_un' has no member named 'sun_len'
  248 |     remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len)
      |           ^
unixstream.c:248:63: error: 'struct sockaddr_un' has no member named 'sun_len'
  248 |     remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len)
      |                                                               ^
unixstream.c:250:59: error: 'struct sockaddr_un' has no member named 'sun_len'
  250 |     err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm);
      |                                                           ^
>How-To-Repeat:

>Fix:


patch-unixstream.c 

$NetBSD$

--- src/unixstream.c.orig       2026-02-26 08:59:59.827096163 +0000
+++ src/unixstream.c
@@ -190,9 +190,7 @@ static const char *unixstream_trybind(p_
     strcpy(local.sun_path, path);
     local.sun_family = AF_UNIX;
 #ifdef UNIX_HAS_SUN_LEN
-    local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len)
-        + len + 1;
-    err = socket_bind(&un->sock, (SA *) &local, local.sun_len);
+    err = socket_bind(&un->sock, (SA *) &local, SUN_LEN(&local));

 #else
     err = socket_bind(&un->sock, (SA *) &local,
@@ -245,9 +243,7 @@ static const char *unixstream_tryconnect
     remote.sun_family = AF_UNIX;
     timeout_markstart(&un->tm);
 #ifdef UNIX_HAS_SUN_LEN
-    remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len)
-        + len + 1;
-    err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm);
+    err = socket_connect(&un->sock, (SA *) &remote, SUN_LEN(&remote), &un->tm);
 #else
     err = socket_connect(&un->sock, (SA *) &remote,
             sizeof(remote.sun_family) + len, &un->tm);


patch-unixdgram.c

$NetBSD$

--- src/unixdgram.c.orig        2026-02-26 09:08:36.227193777 +0000
+++ src/unixdgram.c
@@ -152,9 +152,7 @@ static int meth_sendto(lua_State *L)
     remote.sun_family = AF_UNIX;
     timeout_markstart(tm);
 #ifdef UNIX_HAS_SUN_LEN
-    remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len)
-        + len + 1;
-    err = socket_sendto(&un->sock, data, count, &sent, (SA *) &remote, remote.sun_len, tm);
+    err = socket_sendto(&un->sock, data, count, &sent, (SA *) &remote, SUN_LEN(&remote), tm);
 #else
     err = socket_sendto(&un->sock, data, count, &sent, (SA *) &remote,
                        sizeof(remote.sun_family) + len, tm);
@@ -273,7 +271,7 @@ static const char *unixdgram_trybind(p_u
     local.sun_family = AF_UNIX;
     size_t addrlen = SUN_LEN(&local);
 #ifdef UNIX_HAS_SUN_LEN
-    local.sun_len = addrlen + 1;
+/*    local.sun_len = addrlen + 1;*/
 #endif
     int err = socket_bind(&un->sock, (SA *) &local, addrlen);
     if (err != IO_DONE) socket_destroy(&un->sock);
@@ -324,7 +322,7 @@ static const char *unixdgram_tryconnect(
     timeout_markstart(&un->tm);
     size_t addrlen = SUN_LEN(&remote);
 #ifdef UNIX_HAS_SUN_LEN
-    remote.sun_len = addrlen + 1;
+/*    remote.sun_len = addrlen + 1;*/
 #endif
     int err = socket_connect(&un->sock, (SA *) &remote, addrlen, &un->tm);
     if (err != IO_DONE) socket_destroy(&un->sock);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.