Public bug reported:

Versions of related software:

Ubuntu:
Description:    Ubuntu 18.04.3 LTS
Release:        18.04

Lua interpreter & lua-socket:
lua5.3/bionic-updates,bionic-security,now 5.3.3-1ubuntu0.18.04.1 amd64 
[installed]
lua-socket/bionic,now 3.0~rc1+git+ac3201d-4 amd64 [installed]

Description of a bug:

When i was trying to send something using UDP with a lua-socket library and
sendto the call was always failing.

I found out that normal send is working.

I'am attaching application for test.

On one console you should run netcat: nc -luk -p 9500

On the second console you should run socket-test.lua (first param tells what 
kind of
function to use, see an attached by me code snippet):

stanislawb@stanislawb:~/lua$ ./socket-test.lua send
Using send
ret=    true
err=    16.0
msg=    nil

stanislawb@stanislawb:~/lua$ ./socket-test.lua
Using sendto
ret=    true
err=    nil
msg=    refused

When using send we see that data is going to netcat, using sendto fails
(no data in netcat).

I have strace both cases:

stanislawb@stanislawb:~/lua$ strace -e network -f ./socket-test.lua send
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
Using send
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(9500), 
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
sendto(3, "test12356788888\n", 16, 0, NULL, 0) = 16
ret=    true
err=    16.0
msg=    nil
+++ exited with 0 +++

stanislawb@stanislawb:~/lua$ strace -e network -f ./socket-test.lua
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
Using sendto
ret=    true
err=    nil
msg=    refused
+++ exited with 0 +++

So we see that sendto is even not opening the socket using a socket()
call.

I would add that version of lua-socket downloaded from github and
compiled is working as desired:

git clone https://github.com/diegonehab/luasocket.git
cd luasocket
make LUAV=5.3
sudo cp src/socket-3.0-rc1.so /usr/lib/x86_64-linux-gnu/lua/5.3/socket/core.so

** Affects: luasocket (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: lua

** Attachment added: "Test application"
   
https://bugs.launchpad.net/bugs/1849653/+attachment/5299675/+files/socket-test.lua

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1849653

Title:
  lua:socket udp.sendto is not working at all

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/luasocket/+bug/1849653/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to