Skip to content

Commit 869ba1c

Browse files
committed
Parse custom net box URI (Unix socket) correctly
Until this moment, luatest didn't parse a custom net box URI correctly in the case of a Unix socket if it was as follows: unix/:/tmp/foo1/bar1.iproto login:password@unix/:/tmp/foo2/bar2.iproto So it created wrong directories for such sockets: unix/:/tmp/foo1/ login:password@unix/:/tmp/foo2/ instead of correct ones: /tmp/foo1/ /tmp/foo2/ Now this is fixed. Fixes #313
1 parent 2d51155 commit 869ba1c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

luatest/server.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ function Server:initialize()
163163
if self.net_box_uri == nil and self.net_box_port then
164164
self.net_box_uri = 'localhost:' .. self.net_box_port
165165
end
166-
if uri.parse(self.net_box_uri).host == 'unix/' then
166+
local parsed_net_box_uri = uri.parse(self.net_box_uri)
167+
if parsed_net_box_uri.host == 'unix/' then
167168
-- Linux uses max 108 bytes for Unix domain socket paths, which means a 107 characters
168169
-- string ended by a null terminator. Other systems use 104 bytes and 103 characters strings.
169170
local max_unix_socket_path = {linux = 107, other = 103}
@@ -172,7 +173,7 @@ function Server:initialize()
172173
error(('Net box URI must be <= max Unix domain socket path length (%d chars)')
173174
:format(max_unix_socket_path[system]))
174175
end
175-
fio.mktree(fio.dirname(self.net_box_uri))
176+
fio.mktree(fio.dirname(parsed_net_box_uri.service))
176177
end
177178

178179
self.env = utils.merge(self.env or {}, self:build_env())

0 commit comments

Comments
 (0)