diff --git a/0001-Revert-unix-tcp-avoid-marking-server-sockets-connect.patch b/0001-Revert-unix-tcp-avoid-marking-server-sockets-connect.patch new file mode 100644 index 0000000..4ee5f16 --- /dev/null +++ b/0001-Revert-unix-tcp-avoid-marking-server-sockets-connect.patch @@ -0,0 +1,151 @@ +From 783d19a534bf7f245d5099717666c8f7a7953caa Mon Sep 17 00:00:00 2001 +From: Ben Noordhuis +Date: Fri, 19 Jan 2018 01:24:43 +0100 +Subject: [PATCH 1/3] Revert "unix,tcp: avoid marking server sockets connected" + +Reverted for breaking Node.js in rather spectacular fashion. + +The bug is arguably on the Node.js side. It looks like Node.js starts +reading before the socket is actually connected to something. +Until that is fixed downstream, let's revert the change. + +This reverts commit fd049399aa4ed8495928e375466970d98cb42e17. + +Fixes: https://github.com/libuv/libuv/issues/1716 +Fixes: https://github.com/nodejs/node/issues/18225 +--- + src/unix/stream.c | 6 ------ + src/unix/tcp.c | 8 +++++--- + test/test-list.h | 2 -- + test/test-tcp-bind-error.c | 42 ------------------------------------------ + 4 files changed, 5 insertions(+), 53 deletions(-) + +diff --git a/src/unix/stream.c b/src/unix/stream.c +index bccfd20f..6fc0a01f 100644 +--- a/src/unix/stream.c ++++ b/src/unix/stream.c +@@ -1411,9 +1411,6 @@ int uv_write2(uv_write_t* req, + if (uv__stream_fd(stream) < 0) + return -EBADF; + +- if (!(stream->flags & UV_STREAM_WRITABLE)) +- return -EPIPE; +- + if (send_handle) { + if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) + return -EINVAL; +@@ -1565,9 +1562,6 @@ int uv_read_start(uv_stream_t* stream, + if (stream->flags & UV_CLOSING) + return -EINVAL; + +- if (!(stream->flags & UV_STREAM_READABLE)) +- return -ENOTCONN; +- + /* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just + * expresses the desired state of the user. + */ +diff --git a/src/unix/tcp.c b/src/unix/tcp.c +index a4037851..c7c8d21c 100644 +--- a/src/unix/tcp.c ++++ b/src/unix/tcp.c +@@ -158,7 +158,9 @@ int uv__tcp_bind(uv_tcp_t* tcp, + if ((flags & UV_TCP_IPV6ONLY) && addr->sa_family != AF_INET6) + return -EINVAL; + +- err = maybe_new_socket(tcp, addr->sa_family, 0); ++ err = maybe_new_socket(tcp, ++ addr->sa_family, ++ UV_STREAM_READABLE | UV_STREAM_WRITABLE); + if (err) + return err; + +@@ -333,14 +335,14 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { + if (single_accept) + tcp->flags |= UV_TCP_SINGLE_ACCEPT; + +- flags = 0; ++ flags = UV_STREAM_READABLE; + #if defined(__MVS__) + /* on zOS the listen call does not bind automatically + if the socket is unbound. Hence the manual binding to + an arbitrary port is required to be done manually + */ + flags |= UV_HANDLE_BOUND; +-#endif ++#endif + err = maybe_new_socket(tcp, AF_INET, flags); + if (err) + return err; +diff --git a/test/test-list.h b/test/test-list.h +index d23cf866..8e4f2025 100644 +--- a/test/test-list.h ++++ b/test/test-list.h +@@ -94,7 +94,6 @@ TEST_DECLARE (tcp_bind_error_fault) + TEST_DECLARE (tcp_bind_error_inval) + TEST_DECLARE (tcp_bind_localhost_ok) + TEST_DECLARE (tcp_bind_invalid_flags) +-TEST_DECLARE (tcp_bind_writable_flags) + TEST_DECLARE (tcp_listen_without_bind) + TEST_DECLARE (tcp_connect_error_fault) + TEST_DECLARE (tcp_connect_timeout) +@@ -535,7 +534,6 @@ TASK_LIST_START + TEST_ENTRY (tcp_bind_error_inval) + TEST_ENTRY (tcp_bind_localhost_ok) + TEST_ENTRY (tcp_bind_invalid_flags) +- TEST_ENTRY (tcp_bind_writable_flags) + TEST_ENTRY (tcp_listen_without_bind) + TEST_ENTRY (tcp_connect_error_fault) + TEST_ENTRY (tcp_connect_timeout) +diff --git a/test/test-tcp-bind-error.c b/test/test-tcp-bind-error.c +index 1456d081..10ed68e1 100644 +--- a/test/test-tcp-bind-error.c ++++ b/test/test-tcp-bind-error.c +@@ -214,45 +214,3 @@ TEST_IMPL(tcp_listen_without_bind) { + MAKE_VALGRIND_HAPPY(); + return 0; + } +- +- +-TEST_IMPL(tcp_bind_writable_flags) { +- struct sockaddr_in addr; +- uv_tcp_t server; +- uv_buf_t buf; +- uv_write_t write_req; +- uv_shutdown_t shutdown_req; +- int r; +- +- ASSERT(0 == uv_ip4_addr("0.0.0.0", TEST_PORT, &addr)); +- r = uv_tcp_init(uv_default_loop(), &server); +- ASSERT(r == 0); +- r = uv_tcp_bind(&server, (const struct sockaddr*) &addr, 0); +- ASSERT(r == 0); +- r = uv_listen((uv_stream_t*)&server, 128, NULL); +- ASSERT(r == 0); +- +- ASSERT(0 == uv_is_writable((uv_stream_t*) &server)); +- ASSERT(0 == uv_is_readable((uv_stream_t*) &server)); +- +- buf = uv_buf_init("PING", 4); +- r = uv_write(&write_req, (uv_stream_t*) &server, &buf, 1, NULL); +- ASSERT(r == UV_EPIPE); +- r = uv_shutdown(&shutdown_req, (uv_stream_t*) &server, NULL); +-#ifdef _WIN32 +- ASSERT(r == UV_EPIPE); +-#else +- ASSERT(r == UV_ENOTCONN); +-#endif +- r = uv_read_start((uv_stream_t*) &server, NULL, NULL); +- ASSERT(r == UV_ENOTCONN); +- +- uv_close((uv_handle_t*)&server, close_cb); +- +- uv_run(uv_default_loop(), UV_RUN_DEFAULT); +- +- ASSERT(close_cb_called == 1); +- +- MAKE_VALGRIND_HAPPY(); +- return 0; +-} +-- +2.15.1 + diff --git a/0002-Revert-unix-fs-fix-for-potential-partial-reads-write.patch b/0002-Revert-unix-fs-fix-for-potential-partial-reads-write.patch new file mode 100644 index 0000000..82fafd9 --- /dev/null +++ b/0002-Revert-unix-fs-fix-for-potential-partial-reads-write.patch @@ -0,0 +1,442 @@ +From a37559fdde9d08aad081a28f3118273f61f5a360 Mon Sep 17 00:00:00 2001 +From: Ben Noordhuis +Date: Fri, 19 Jan 2018 01:24:43 +0100 +Subject: [PATCH 2/3] Revert "unix,fs: fix for potential partial reads/writes" + +This commit has been reported as introducing a backwards-incompatible +change in reading from stdin and is independently suspected of breaking +the Node.js test suite on MacOS and maybe other platforms, possibly in +combination with commit fd049399 ("unix,tcp: avoid marking server +sockets connected".) + +This reverts commit 14bfc27e641aff178c431083c0c0eada4d6f02dd. + +Fixes: https://github.com/libuv/libuv/issues/1716 +Fixes: https://github.com/libuv/libuv/issues/1720 +Fixes: https://github.com/nodejs/node/issues/18225 +--- + Makefile.am | 1 + + src/unix/fs.c | 62 +++++++++++++++------- + test/test-eintr-handling.c | 94 +++++++++++++++++++++++++++++++++ + test/test-fs.c | 127 +-------------------------------------------- + test/test-list.h | 6 +-- + uv.gyp | 1 + + 6 files changed, 141 insertions(+), 150 deletions(-) + create mode 100644 test/test-eintr-handling.c + +diff --git a/Makefile.am b/Makefile.am +index c49802f7..ae9d96bc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -165,6 +165,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ + test/test-default-loop-close.c \ + test/test-delayed-accept.c \ + test/test-dlerror.c \ ++ test/test-eintr-handling.c \ + test/test-embed.c \ + test/test-emfile.c \ + test/test-env-vars.c \ +diff --git a/src/unix/fs.c b/src/unix/fs.c +index 79864638..e0969a4c 100644 +--- a/src/unix/fs.c ++++ b/src/unix/fs.c +@@ -334,7 +334,25 @@ static ssize_t uv__fs_read(uv_fs_t* req) { + if (no_preadv) retry: + # endif + { +- result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); ++ off_t nread; ++ size_t index; ++ ++ nread = 0; ++ index = 0; ++ result = 1; ++ do { ++ if (req->bufs[index].len > 0) { ++ result = pread(req->file, ++ req->bufs[index].base, ++ req->bufs[index].len, ++ req->off + nread); ++ if (result > 0) ++ nread += result; ++ } ++ index++; ++ } while (index < req->nbufs && result > 0); ++ if (nread > 0) ++ result = nread; + } + # if defined(__linux__) + else { +@@ -722,7 +740,25 @@ static ssize_t uv__fs_write(uv_fs_t* req) { + if (no_pwritev) retry: + # endif + { +- r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); ++ off_t written; ++ size_t index; ++ ++ written = 0; ++ index = 0; ++ r = 0; ++ do { ++ if (req->bufs[index].len > 0) { ++ r = pwrite(req->file, ++ req->bufs[index].base, ++ req->bufs[index].len, ++ req->off + written); ++ if (r > 0) ++ written += r; ++ } ++ index++; ++ } while (index < req->nbufs && r >= 0); ++ if (written > 0) ++ r = written; + } + # if defined(__linux__) + else { +@@ -972,19 +1008,6 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) { + return ret; + } + +-static size_t uv__fs_buf_offset(uv_buf_t* bufs, size_t size) { +- size_t offset; +- /* Figure out which bufs are done */ +- for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset) +- size -= bufs[offset].len; +- +- /* Fix a partial read/write */ +- if (size > 0) { +- bufs[offset].base += size; +- bufs[offset].len -= size; +- } +- return offset; +-} + + typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req); + static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) { +@@ -1004,10 +1027,7 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) + if (req->nbufs > iovmax) + req->nbufs = iovmax; + +- do +- result = process(req); +- while (result < 0 && errno == EINTR); +- ++ result = process(req); + if (result <= 0) { + if (total == 0) + total = result; +@@ -1017,12 +1037,14 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) + if (req->off >= 0) + req->off += result; + +- req->nbufs = uv__fs_buf_offset(req->bufs, result); + req->bufs += req->nbufs; + nbufs -= req->nbufs; + total += result; + } + ++ if (errno == EINTR && total == -1) ++ return total; ++ + if (bufs != req->bufsml) + uv__free(bufs); + +diff --git a/test/test-eintr-handling.c b/test/test-eintr-handling.c +new file mode 100644 +index 00000000..1aaf623b +--- /dev/null ++++ b/test/test-eintr-handling.c +@@ -0,0 +1,94 @@ ++/* Copyright libuv project contributors. All rights reserved. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to ++ * deal in the Software without restriction, including without limitation the ++ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ++ * IN THE SOFTWARE. ++ */ ++ ++#include "uv.h" ++#include "task.h" ++ ++#ifdef _WIN32 ++ ++TEST_IMPL(eintr_handling) { ++ RETURN_SKIP("Test not implemented on Windows."); ++} ++ ++#else /* !_WIN32 */ ++ ++#include ++#include ++ ++static uv_loop_t* loop; ++static uv_fs_t read_req; ++static uv_buf_t iov; ++ ++static char buf[32]; ++static char test_buf[] = "test-buffer\n"; ++int pipe_fds[2]; ++ ++struct thread_ctx { ++ uv_barrier_t barrier; ++ int fd; ++}; ++ ++static void thread_main(void* arg) { ++ int nwritten; ++ ASSERT(0 == kill(getpid(), SIGUSR1)); ++ ++ do ++ nwritten = write(pipe_fds[1], test_buf, sizeof(test_buf)); ++ while (nwritten == -1 && errno == EINTR); ++ ++ ASSERT(nwritten == sizeof(test_buf)); ++} ++ ++static void sig_func(uv_signal_t* handle, int signum) { ++ uv_signal_stop(handle); ++} ++ ++TEST_IMPL(eintr_handling) { ++ struct thread_ctx ctx; ++ uv_thread_t thread; ++ uv_signal_t signal; ++ int nread; ++ ++ iov = uv_buf_init(buf, sizeof(buf)); ++ loop = uv_default_loop(); ++ ++ ASSERT(0 == uv_signal_init(loop, &signal)); ++ ASSERT(0 == uv_signal_start(&signal, sig_func, SIGUSR1)); ++ ++ ASSERT(0 == pipe(pipe_fds)); ++ ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx)); ++ ++ nread = uv_fs_read(loop, &read_req, pipe_fds[0], &iov, 1, -1, NULL); ++ ++ ASSERT(nread == sizeof(test_buf)); ++ ASSERT(0 == strcmp(buf, test_buf)); ++ ++ ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); ++ ++ ASSERT(0 == close(pipe_fds[0])); ++ ASSERT(0 == close(pipe_fds[1])); ++ uv_close((uv_handle_t*) &signal, NULL); ++ ++ MAKE_VALGRIND_HAPPY(); ++ return 0; ++} ++ ++#endif /* !_WIN32 */ +diff --git a/test/test-fs.c b/test/test-fs.c +index d43d6e61..241416bc 100644 +--- a/test/test-fs.c ++++ b/test/test-fs.c +@@ -2890,131 +2890,6 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { + } + + +-#ifdef _WIN32 +- +-TEST_IMPL(fs_partial_read) { +- RETURN_SKIP("Test not implemented on Windows."); +-} +- +-TEST_IMPL(fs_partial_write) { +- RETURN_SKIP("Test not implemented on Windows."); +-} +- +-#else /* !_WIN32 */ +- +-static void thread_exec(int fd, char* data, int size, int interval, int doread) { +- pid_t pid; +- ssize_t result; +- +- pid = getpid(); +- result = 1; +- +- while (size > 0 && result > 0) { +- do { +- if (doread) +- result = write(fd, data, size < interval ? size : interval); +- else +- result = read(fd, data, size < interval ? size : interval); +- } while (result == -1 && errno == EINTR); +- +- kill(pid, SIGUSR1); +- size -= result; +- data += result; +- } +- +- ASSERT(size == 0); +- ASSERT(result > 0); +-} +- +-struct thread_ctx { +- int fd; +- char *data; +- int size; +- int interval; +- int doread; +-}; +- +-static void thread_main(void* arg) { +- struct thread_ctx *ctx; +- ctx = (struct thread_ctx*)arg; +- thread_exec(ctx->fd, ctx->data, ctx->size, ctx->interval, ctx->doread); +-} +- +-static void sig_func(uv_signal_t* handle, int signum) { +- uv_signal_stop(handle); +-} +- +-static void test_fs_partial(int doread) { +- struct thread_ctx ctx; +- uv_thread_t thread; +- uv_signal_t signal; +- int pipe_fds[2]; +- size_t iovcount; +- uv_buf_t* iovs; +- char* buffer; +- size_t index; +- int result; +- +- iovcount = 54321; +- +- iovs = malloc(sizeof(*iovs) * iovcount); +- ASSERT(iovs != NULL); +- +- ctx.doread = doread; +- ctx.interval = 1000; +- ctx.size = sizeof(test_buf) * iovcount; +- ctx.data = malloc(ctx.size); +- ASSERT(ctx.data != NULL); +- buffer = malloc(ctx.size); +- ASSERT(buffer != NULL); +- +- for (index = 0; index < iovcount; ++index) +- iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), sizeof(test_buf)); +- +- loop = uv_default_loop(); +- +- ASSERT(0 == uv_signal_init(loop, &signal)); +- ASSERT(0 == uv_signal_start(&signal, sig_func, SIGUSR1)); +- +- ASSERT(0 == pipe(pipe_fds)); +- +- ctx.fd = pipe_fds[doread]; +- ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx)); +- +- if (doread) +- result = uv_fs_read(loop, &read_req, pipe_fds[0], iovs, iovcount, -1, NULL); +- else +- result = uv_fs_write(loop, &write_req, pipe_fds[1], iovs, iovcount, -1, NULL); +- +- ASSERT(result == ctx.size); +- ASSERT(0 == memcmp(buffer, ctx.data, result)); +- +- ASSERT(0 == uv_thread_join(&thread)); +- ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); +- +- ASSERT(0 == close(pipe_fds[0])); +- ASSERT(0 == close(pipe_fds[1])); +- uv_close((uv_handle_t*) &signal, NULL); +- +- free(iovs); +- free(buffer); +- free(ctx.data); +- +- MAKE_VALGRIND_HAPPY(); +-} +- +-TEST_IMPL(fs_partial_read) { +- test_fs_partial(1); +- return 0; +-} +- +-TEST_IMPL(fs_partial_write) { +- test_fs_partial(0); +- return 0; +-} +- +-#endif/* _WIN32 */ +- + TEST_IMPL(fs_read_write_null_arguments) { + int r; + +@@ -3223,7 +3098,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) { + unlink("test_file"); + + ASSERT(UV_FS_O_EXLOCK > 0); +- ++ + r = uv_fs_open(NULL, + &open_req1, + "test_file", +diff --git a/test/test-list.h b/test/test-list.h +index 8e4f2025..5a50ec67 100644 +--- a/test/test-list.h ++++ b/test/test-list.h +@@ -213,6 +213,7 @@ TEST_DECLARE (active) + TEST_DECLARE (embed) + TEST_DECLARE (async) + TEST_DECLARE (async_null_cb) ++TEST_DECLARE (eintr_handling) + TEST_DECLARE (get_currentexe) + TEST_DECLARE (process_title) + TEST_DECLARE (process_title_threadsafe) +@@ -324,8 +325,6 @@ TEST_DECLARE (fs_read_write_null_arguments) + TEST_DECLARE (get_osfhandle_valid_handle) + TEST_DECLARE (fs_write_alotof_bufs) + TEST_DECLARE (fs_write_alotof_bufs_with_offset) +-TEST_DECLARE (fs_partial_read) +-TEST_DECLARE (fs_partial_write) + TEST_DECLARE (fs_file_pos_after_op_with_offset) + TEST_DECLARE (fs_null_req) + #ifdef _WIN32 +@@ -675,6 +674,7 @@ TASK_LIST_START + + TEST_ENTRY (async) + TEST_ENTRY (async_null_cb) ++ TEST_ENTRY (eintr_handling) + + TEST_ENTRY (get_currentexe) + +@@ -848,8 +848,6 @@ TASK_LIST_START + TEST_ENTRY (fs_write_multiple_bufs) + TEST_ENTRY (fs_write_alotof_bufs) + TEST_ENTRY (fs_write_alotof_bufs_with_offset) +- TEST_ENTRY (fs_partial_read) +- TEST_ENTRY (fs_partial_write) + TEST_ENTRY (fs_read_write_null_arguments) + TEST_ENTRY (fs_file_pos_after_op_with_offset) + TEST_ENTRY (fs_null_req) +diff --git a/uv.gyp b/uv.gyp +index 19008dfa..46606c5b 100644 +--- a/uv.gyp ++++ b/uv.gyp +@@ -371,6 +371,7 @@ + 'test/test-cwd-and-chdir.c', + 'test/test-default-loop-close.c', + 'test/test-delayed-accept.c', ++ 'test/test-eintr-handling.c', + 'test/test-error.c', + 'test/test-embed.c', + 'test/test-emfile.c', +-- +2.15.1 + diff --git a/0003-Revert-win-use-RemoveDirectoryW-instead-of-_wmrmdir.patch b/0003-Revert-win-use-RemoveDirectoryW-instead-of-_wmrmdir.patch new file mode 100644 index 0000000..9073766 --- /dev/null +++ b/0003-Revert-win-use-RemoveDirectoryW-instead-of-_wmrmdir.patch @@ -0,0 +1,99 @@ +From c9ebff2c73a6130587534527386a7d398be94d58 Mon Sep 17 00:00:00 2001 +From: Ben Noordhuis +Date: Fri, 19 Jan 2018 01:24:43 +0100 +Subject: [PATCH 3/3] Revert "win: use RemoveDirectoryW() instead of + _wmrmdir()" + +Reverted for breaking `test/parallel/test-child-process-cwd.js` from the +Node.js test suite. Instead of ENOENT when trying to remove a directory +that does not exist, it started failing with ENOTDIR. + +This reverts commit 15f29dc08fe72cd189002f1b8ae22fd82264deef. +--- + src/win/error.c | 2 +- + src/win/fs.c | 7 ++----- + test/test-fs.c | 22 ++++------------------ + 3 files changed, 7 insertions(+), 24 deletions(-) + +diff --git a/src/win/error.c b/src/win/error.c +index 1ec3d6e2..9b03bfef 100644 +--- a/src/win/error.c ++++ b/src/win/error.c +@@ -131,7 +131,7 @@ int uv_translate_sys_error(int sys_errno) { + case WSAENETUNREACH: return UV_ENETUNREACH; + case WSAENOBUFS: return UV_ENOBUFS; + case ERROR_BAD_PATHNAME: return UV_ENOENT; +- case ERROR_DIRECTORY: return UV_ENOTDIR; ++ case ERROR_DIRECTORY: return UV_ENOENT; + case ERROR_FILE_NOT_FOUND: return UV_ENOENT; + case ERROR_INVALID_NAME: return UV_ENOENT; + case ERROR_INVALID_DRIVE: return UV_ENOENT; +diff --git a/src/win/fs.c b/src/win/fs.c +index 0905a24e..097b00e0 100644 +--- a/src/win/fs.c ++++ b/src/win/fs.c +@@ -723,11 +723,8 @@ void fs__write(uv_fs_t* req) { + + + void fs__rmdir(uv_fs_t* req) { +- if (RemoveDirectoryW(req->file.pathw)) { +- SET_REQ_SUCCESS(req); +- } else { +- SET_REQ_WIN32_ERROR(req, GetLastError()); +- } ++ int result = _wrmdir(req->file.pathw); ++ SET_REQ_RESULT(req, result); + } + + +diff --git a/test/test-fs.c b/test/test-fs.c +index 241416bc..7c481f07 100644 +--- a/test/test-fs.c ++++ b/test/test-fs.c +@@ -469,19 +469,10 @@ static void mkdtemp_cb(uv_fs_t* req) { + static void rmdir_cb(uv_fs_t* req) { + ASSERT(req == &rmdir_req); + ASSERT(req->fs_type == UV_FS_RMDIR); ++ ASSERT(req->result == 0); ++ rmdir_cb_count++; + ASSERT(req->path); +- switch (rmdir_cb_count++) { +- default: +- ASSERT(0); +- case 0: +- ASSERT(req->result == UV_ENOTDIR); +- ASSERT(memcmp(req->path, "test_dir/file1\0", 15) == 0); +- break; +- case 1: +- ASSERT(req->result == 0); +- ASSERT(memcmp(req->path, "test_dir\0", 9) == 0); +- break; +- } ++ ASSERT(memcmp(req->path, "test_dir\0", 9) == 0); + uv_fs_req_cleanup(req); + } + +@@ -995,11 +986,6 @@ TEST_IMPL(fs_async_dir) { + + ASSERT(stat_cb_count == 4); + +- r = uv_fs_rmdir(loop, &rmdir_req, "test_dir/file1", rmdir_cb); +- ASSERT(r == 0); +- uv_run(loop, UV_RUN_DEFAULT); +- ASSERT(rmdir_cb_count == 1); +- + r = uv_fs_unlink(loop, &unlink_req, "test_dir/file1", unlink_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); +@@ -1013,7 +999,7 @@ TEST_IMPL(fs_async_dir) { + r = uv_fs_rmdir(loop, &rmdir_req, "test_dir", rmdir_cb); + ASSERT(r == 0); + uv_run(loop, UV_RUN_DEFAULT); +- ASSERT(rmdir_cb_count == 2); ++ ASSERT(rmdir_cb_count == 1); + + /* Cleanup */ + unlink("test_dir/file1"); +-- +2.15.1 + diff --git a/libuv.spec b/libuv.spec index 7dd7009..1440b57 100644 --- a/libuv.spec +++ b/libuv.spec @@ -1,7 +1,7 @@ Name: libuv Epoch: 1 Version: 1.19.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Platform layer for node.js # the licensing breakdown is described in detail in the LICENSE file @@ -9,6 +9,10 @@ License: MIT and BSD and ISC URL: http://libuv.org/ Source0: http://dist.libuv.org/dist/v%{version}/libuv-v%{version}.tar.gz Source2: %{name}.pc.in +# https://github.com/libuv/libuv/pull/1717 +Patch0001: 0001-Revert-unix-tcp-avoid-marking-server-sockets-connect.patch +Patch0002: 0002-Revert-unix-fs-fix-for-potential-partial-reads-write.patch +Patch0003: 0003-Revert-win-use-RemoveDirectoryW-instead-of-_wmrmdir.patch BuildRequires: autoconf automake libtool BuildRequires: gcc @@ -33,7 +37,7 @@ Requires: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release} Static library (.a) version of libuv. %prep -%setup -q -n %{name}-v%{version} +%autosetup -n %{name}-v%{version} -p1 %build ./autogen.sh @@ -68,6 +72,9 @@ rm -f %{buildroot}%{_libdir}/libuv.la %{_libdir}/%{name}.a %changelog +* Fri Jan 19 2018 Igor Gnatenko - 1:1.19.0-2 +- Revert few commits which cause regression for nodejs + * Thu Jan 18 2018 Igor Gnatenko - 1:1.19.0-1 - Update to 1.19.0