To: vim_dev@googlegroups.com Subject: Patch 9.0.1165 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1165 Problem: Tests using IPv6 sometimes fail. Solution: Use getaddrinfo() and use try/catch. (James McCoy, closes #11783) Files: src/testdir/test_channel.py, src/testdir/test_channel_lsp.py, src/testdir/test_netbeans.py, src/testdir/test_netbeans.vim *** ../vim-9.0.1164/src/testdir/test_channel.py 2022-04-04 21:09:49.000000000 +0100 --- src/testdir/test_channel.py 2023-01-09 16:22:56.290926675 +0000 *************** *** 259,265 **** print("Wait for it...") time.sleep(0.5) ! server = server_class((host, port), ThreadedTCPRequestHandler) ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread --- 259,270 ---- print("Wait for it...") time.sleep(0.5) ! addrs = socket.getaddrinfo(host, port, 0, 0, socket.IPPROTO_TCP) ! # Each addr is a (family, type, proto, canonname, sockaddr) tuple ! sockaddr = addrs[0][4] ! server_class.address_family = addrs[0][0] ! ! server = server_class(sockaddr[0:2], ThreadedTCPRequestHandler) ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread *** ../vim-9.0.1164/src/testdir/test_channel_lsp.py 2022-11-02 13:30:37.542314565 +0000 --- src/testdir/test_channel_lsp.py 2023-01-09 16:22:56.290926675 +0000 *************** *** 306,312 **** writePortInFile(port) time.sleep(0.5) ! server = server_class((host, port), ThreadedTCPRequestHandler) ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread --- 306,317 ---- writePortInFile(port) time.sleep(0.5) ! addrs = socket.getaddrinfo(host, port, 0, 0, socket.IPPROTO_TCP) ! # Each addr is a (family, type, proto, canonname, sockaddr) tuple ! sockaddr = addrs[0][4] ! server_class.address_family = addrs[0][0] ! ! server = server_class(sockaddr[0:2], ThreadedTCPRequestHandler) ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread *** ../vim-9.0.1164/src/testdir/test_netbeans.py 2020-11-02 18:58:58.000000000 +0000 --- src/testdir/test_netbeans.py 2023-01-09 16:22:56.294926675 +0000 *************** *** 184,191 **** if __name__ == "__main__": HOST, PORT = "localhost", 0 ! server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) ! ip, port = server.server_address # Start a thread with the server. That thread will then start a new thread # for each connection. --- 184,196 ---- if __name__ == "__main__": HOST, PORT = "localhost", 0 ! addrs = socket.getaddrinfo(HOST, PORT, 0, 0, socket.IPPROTO_TCP) ! # Each addr is a (family, type, proto, canonname, sockaddr) tuple ! sockaddr = addrs[0][4] ! ThreadedTCPServer.address_family = addrs[0][0] ! ! server = ThreadedTCPServer(sockaddr[0:2], ThreadedTCPRequestHandler) ! ip, port = server.server_address[0:2] # Start a thread with the server. That thread will then start a new thread # for each connection. *************** *** 199,205 **** # Main thread terminates, but the server continues running # until server.shutdown() is called. try: ! while server_thread.isAlive(): server_thread.join(1) except (KeyboardInterrupt, SystemExit): server.shutdown() --- 204,210 ---- # Main thread terminates, but the server continues running # until server.shutdown() is called. try: ! while server_thread.is_alive(): server_thread.join(1) except (KeyboardInterrupt, SystemExit): server.shutdown() *** ../vim-9.0.1164/src/testdir/test_netbeans.vim 2022-09-29 21:37:19.321641591 +0100 --- src/testdir/test_netbeans.vim 2023-01-09 16:22:56.294926675 +0000 *************** *** 887,914 **** return filter(l, 'v:val !~ "^0:geometry="') endfunc ! " Establish the connection with the netbeans server ! exe 'nbstart :localhost:' .. g:port .. ':star' ! call assert_true(has("netbeans_enabled")) ! call WaitFor('len(ReadXnetbeans()) >= 3') ! let l = ReadXnetbeans() ! call assert_equal(['AUTH star', ! \ '0:version=0 "2.5"', ! \ '0:startupDone=0'], l[-3:]) ! " Open the command buffer to communicate with the server ! split Xcmdbuf ! call WaitFor('len(ReadXnetbeans()) >= 6') ! let l = ReadXnetbeans() ! call assert_equal('0:fileOpened=0 "Xcmdbuf" T F', ! \ substitute(l[-3], '".*/', '"', '')) ! call assert_equal('send: 1:putBufferNumber!15 "Xcmdbuf"', ! \ substitute(l[-2], '".*/', '"', '')) ! call assert_equal('1:startDocumentListen!16', l[-1]) ! sleep 1m ! quit! ! quit! END if RunVim(['let g:port = ' .. a:port], after, '') call WaitFor('len(ReadXnetbeans()) >= 9') --- 887,918 ---- return filter(l, 'v:val !~ "^0:geometry="') endfunc ! try ! " Establish the connection with the netbeans server ! exe 'nbstart :localhost:' .. g:port .. ':star' ! call assert_true(has("netbeans_enabled")) ! call WaitFor('len(ReadXnetbeans()) >= 3') ! let l = ReadXnetbeans() ! call assert_equal(['AUTH star', ! \ '0:version=0 "2.5"', ! \ '0:startupDone=0'], l[-3:]) ! " Open the command buffer to communicate with the server ! split Xcmdbuf ! call WaitFor('len(ReadXnetbeans()) >= 6') ! let l = ReadXnetbeans() ! call assert_equal('0:fileOpened=0 "Xcmdbuf" T F', ! \ substitute(l[-3], '".*/', '"', '')) ! call assert_equal('send: 1:putBufferNumber!15 "Xcmdbuf"', ! \ substitute(l[-2], '".*/', '"', '')) ! call assert_equal('1:startDocumentListen!16', l[-1]) ! sleep 1m ! quit! ! quit! ! finally ! qall! ! endtry END if RunVim(['let g:port = ' .. a:port], after, '') call WaitFor('len(ReadXnetbeans()) >= 9') *** ../vim-9.0.1164/src/version.c 2023-01-09 15:10:36.245547545 +0000 --- src/version.c 2023-01-09 16:24:34.742924390 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1165, /**/ -- BEDEVERE: Wait. Wait ... tell me, what also floats on water? ALL: Bread? No, no, no. Apples .... gravy ... very small rocks ... ARTHUR: A duck. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///