Permalink
Commits on Aug 3, 2012
  1. windows: map WSANO_DATA to UV_ENOENT

    piscisaureus committed Aug 3, 2012
    This improves uv_getaddrinfo error reporting.
Commits on Jul 31, 2012
  1. windows: only allow opening directories for reading

    piscisaureus committed Jul 31, 2012
    This is closer to the Posix model.
  2. windows: initialize uv_fs_t.path to NULL

    piscisaureus committed Jul 31, 2012
    This shouldn't be necessary, but node v0.8 relies on it.
  3. windows: improve uv_fs_unlink

    piscisaureus committed Jul 31, 2012
    * It's now more efficient, the file is not opened twice.
    * It no longer allows deletion of non-symlink directory reparse points.
  4. windows: fix regression in uv_fs_link

    piscisaureus committed Jul 31, 2012
    Old and new path were accidentally reversed.
  5. sunos: workaround OS bug to prevent fs.watch() from spinning

    bnoordhuis committed Jul 31, 2012
    This is a back-port of commit cfb06db from the master branch.
    
    Fixes nodejs/node-v0.x-archive#3768.
Commits on Jul 30, 2012
  1. windows: fix memory leaks in fs

    piscisaureus committed Jul 30, 2012
    Also clean up the code in various ways.
  2. Avoid compiler warning

    piscisaureus committed Jul 30, 2012
Commits on Jul 28, 2012
  1. linux: fix 'two watchers, one path' segfault

    bnoordhuis committed Jul 28, 2012
    Problem: registering two uv_fs_event_t watchers for the same path, then closing
    them, caused a segmentation fault. While active, the watchers didn't work right
    either, only one would receive events.
    
    Cause: each watcher has a wd (watch descriptor) that's used as its key in a
    binary tree. When you call inotify_watch_add() twice with the same path, the
    second call doesn't return a new wd - it returns the existing one. That in turn
    resulted in the first handle getting ousted from the binary tree, leaving
    dangling pointers.
    
    This commit addresses that by storing the watchers in a queue and storing the
    queue in the binary tree instead of storing the watchers directly in the tree.
    
    Fixes nodejs/node-v0.x-archive#3789.
  2. test: add failing fs_event test

    bnoordhuis committed Jul 28, 2012
    Watches the same file twice. Fails on Linux with a segmentation fault.
Commits on Jul 25, 2012
Commits on Jul 19, 2012
  1. unix: fix format string vulnerability in freebsd.c

    bnoordhuis committed Jul 13, 2012
    uv_set_process_title() was susceptible to a format string vulnerability:
    
      $ node -e 'process.title = Array(42).join("%s")'
      Segmentation fault: 11 (core dumped)
    
    The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
    but valgrind complains loudly about reads from and writes to uninitialized
    memory in libc. It's not a libuv bug because the test case below triggers the
    same warnings:
    
      #include <sys/types.h>
      #include <unistd.h>
    
      int main(void)
      {
        setproctitle("%s", "test");
        return 0;
      }
    
    That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
    
    This commit reapplies commit a9f6f06, which got reverted in 69a6afe. The revert
    turned out to be unnecessary.
  2. unix: fix uv_pipe_connect() with existing fd

    bnoordhuis committed Jul 19, 2012
    Don't create a new socket descriptor if one has been previously assigned with
    uv_pipe_open().
  3. unix: fix errno reporting in uv_pipe_connect()

    bnoordhuis committed Jul 19, 2012
    Remember the errno when the socket() syscall fails.
Commits on Jul 18, 2012
  1. unix: undo changes to uv_set_process_title()

    bnoordhuis committed Jul 18, 2012
    It's making node.js crash when run as root. Backtrace:
    
      (gdb) bt
      #0  0x00007fff856e3ff9 in __findenv ()
      #1  0x00007fff856e404c in getenv ()
      #2  0x000000010004c850 in loop_init (loop=0x10045a792, flags=8) at ev.c:1707
      #3  0x000000010004cb3b in ev_backend [inlined] () at /Users/tjfontaine/Development/node/deps/uv/src/unix/ev/ev.c:2090
      #4  0x000000010004cb3b in ev_default_loop (flags=1606417108) at ev.c:2092
      #5  0x000000010004e5c6 in uv__loop_init (loop=0x10066e330, default_loop=1) at loop.c:52
      #6  0x0000000100044367 in uv_default_loop () at core.c:196
      #7  0x0000000100004625 in node::Init (argc=1606417456, argv=0x100b0f490) at node.cc:2761
      #8  0x000000010000797d in node::Start (argc=1606417600, argv=0x0) at node.cc:2888
      #9  0x0000000100000ca4 in start ()
    
    This reverts commits:
    
      b49d6f7 unix: fix uv_set_process_title()
      a9f6f06 unix: fix format string vulnerability in freebsd.c
      a87abc7 unix: avoid buffer overflow in proctitle.c
      dc97d44 unix: move uv_set_process_title() to proctitle.c
Commits on Jul 17, 2012
  1. unix: fix uv_set_process_title()

    bnoordhuis committed Jul 17, 2012
    Use strncpy() to set the process title, it pads the remainder with nul bytes.
    Avoids garbage output on systems where `ps aux` prints the entire proctitle
    buffer, not just the characters up to the first '\0'.
    
    Fixes nodejs/node-v0.x-archive#3726.
Commits on Jul 13, 2012
  1. unix: fix format string vulnerability in freebsd.c

    bnoordhuis committed Jul 13, 2012
    uv_set_process_title() was susceptible to a format string vulnerability:
    
      $ node -e 'process.title = Array(42).join("%s")'
      Segmentation fault: 11 (core dumped)
    
    The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
    but valgrind complains loudly about reads from and writes to uninitialized
    memory in libc. It's not a libuv bug because the test case below triggers the
    same warnings:
    
      #include <stdio.h>
      #include <stdlib.h>
      #include <sys/types.h>
      #include <unistd.h>
    
      int main(void)
      {
        setproctitle("%s", "test");
        return 0;
      }
    
    That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
  2. unix: avoid buffer overflow in proctitle.c

    bnoordhuis committed Jul 13, 2012
    Get/set process title with uv_strlcpy(), not strncpy(). The latter won't
    zero-terminate the result if the destination buffer is too small.
  3. unix: move uv_set_process_title() to proctitle.c

    indutny committed with bnoordhuis Jul 11, 2012
    Use hijacking argv array to change process' title. It seems to be working fine
    on almost every platform (at least it should not break anything as it's used in
    nginx in a similar way).
Commits on Jul 10, 2012
Commits on Jul 4, 2012
Commits on Jul 3, 2012
  1. test: allow 80 ms intervals in hrtime test

    bnoordhuis committed Jul 3, 2012
    The hrtimer functionality on my FreeBSD 9 system is fairly coarse, it's usually
    just over the 60 ms that we tested for before this commit.
  2. unix: rename linux/core.c to linux/linux-core.c

    bnoordhuis committed Jun 22, 2012
    This is a back-port of commit e132075 from the master branch.
    
    Newer versions of gyp do not support files with the same basenames (example:
    core.c and linux/core.c).
    
    The nominal reason is consistency across build systems. Apparently, msbuild
    doesn't support it either.
    
    Somewhere, someplace, baby Jesus cries sad little tears...
    
    Fixes #464.
Commits on Jul 1, 2012
Commits on Jun 30, 2012
  1. unix: fix busy loop on unexpected tcp message

    bnoordhuis committed Jun 30, 2012
    Don't start reading immediately after connecting. If the server sends a message
    and the client hasn't called uv_read_start() yet, the event loop will busy loop
    because the pending message keeps waking it up.
  2. test: add 'unexpected read' tcp test

    bnoordhuis committed Jun 30, 2012
    Regression test that verifies that the event loop doesn't busy loop when
    the server sends a message and the client isn't reading.
Commits on Jun 29, 2012
  1. unix: fix EINPROGRESS busy loop

    bnoordhuis committed Jun 29, 2012
    Don't make the event loop spin when connect() returns EINPROGRESS.
    
    Test case:
    
      #include "uv.h"
    
      static void connect_cb(uv_connect_t* req, int status) {
        // ...
      }
    
      int main() {
        uv_tcp_t handle;
        uv_connect_t req;
        struct sockaddr_in addr;
        addr = uv_ip4_addr("8.8.8.8", 1234); // unreachable
        uv_tcp_init(uv_default_loop(), &handle);
        uv_tcp_connect(&req, (uv_stream_t*)&handle, addr, connect_cb);
        uv_run(uv_default_loop()); // busy loops until connection times out
        return 0;
      }
    
    After EINPROGRESS, there are zero active handles and one active request. That
    in turn makes uv__poll_timeout() believe that it should merely poll, not block,
    in epoll() / kqueue() / port_getn().
    
    Sidestep that by artificially starting the handle on connect() and stopping it
    again once the TCP handshake completes / is rejected / times out.
    
    It's a slightly hacky approach because I don't want to change the ABI of the
    stable branch. I'll address it properly in the master branch.
  2. unix: deduplicate socket creation code in tcp.c

    bnoordhuis committed Jun 29, 2012
    Incidentally fixes a rather obscure bug where uv_tcp_connect() reconnected
    and leaked a file descriptor when the handle was already busy connecting,
    handle->fd was zero (unlikely) and uv_tcp_connect() got called again.