pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lua-socket vs sockaddr_un




To: pkgsrc-users%netbsd.org@localhost

Subject: lua-socket vs sockaddr_un

From: Stephen Borrill <netbsd%precedence.co.uk@localhost>

Date: Wed, 12 Nov 2025 11:58:49 +0000 (GMT)


When building net/lua-socket, defining UNIX_HAS_SUN_LEN alters the size  passed to socket_bind() to take into account the difference in definitions  of sockaddr_un on Linux vs other OSes:

https://github.com/lunarmodules/luasocket/blob/4844a48fbf76b0400fd7b7e4d15d244484019df1/src/unixstream.c#L191-L199

If the 
platform (PLAT) is set to macos or freebsd, UNIX_HAS_SUN_LEN is  defined:
https://github.com/lunarmodules/luasocket/blob/4844a48fbf76b0400fd7b7e4d15d244484019df1/src/makefile#L190-L201

However, pkgsrc does not
 set the platform and so it defaults to linux,  meaning UNIX_HAS_SUN_LEN is not defined and therefore the filename of the  socket gets truncated. As pkgsrc is cross-platform, it's probably OK to  carry on with PLAT=linux, but set UNIX_HAS_SUN_LEN based on PLATFORM in  the Makefile.

On the oth
er hand, this also just looks like over-engineering in  luasocket to me. What's wrong with just using sizeof(sockaddr_un)  unconditionally? Even taking the BUGS section of the relevant Linux man  page into account, the length check and memcpy() calls should be OK.

https://man7.org/linux/man-pages/man7/unix.7.html#BUGS

--
Stephen





Prev by Date: Re: xdemineur build fails

Next by Date: Re: Pkgsrc WIP package to upgrade Helix to 25.07.1

Previous by Thread: emulators/wine build failure

Next by Thread: Upgrade issue with macOS binary package repository

Indexes:

reverse Date

reverse Thread

Old Index



Home | Main Index | Thread Index | Old Index