From 8258bd467a178297096f409e305f0d04abc765a7 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 5 Mar 2012 10:28:47 -0800 Subject: [PATCH 1/4] doc: 'filename' arg not guaranteed ever. --- doc/api/fs.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown index e30025858b..5b657a7cd9 100644 --- a/doc/api/fs.markdown +++ b/doc/api/fs.markdown @@ -469,8 +469,7 @@ reliable. -When watching a directory, -providing `filename` argument in the callback is not supported +Providing `filename` argument in the callback is not supported on every platform (currently it's only supported on Linux and Windows). Even on supported platforms `filename` is not always guaranteed to be provided. Therefore, don't assume that `filename` argument is always provided in the From 33f9074a621f5f62dea018e61968a2617397f738 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 5 Mar 2012 10:59:14 -0800 Subject: [PATCH 2/4] Mention marked, and add license to doc generator --- LICENSE | 7 ++++++- tools/doc/LICENSE | 18 ++++++++++++++++++ tools/doc/generate.js | 20 ++++++++++++++++++++ tools/doc/html.js | 21 +++++++++++++++++++++ tools/doc/json.js | 21 +++++++++++++++++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 tools/doc/LICENSE diff --git a/LICENSE b/LICENSE index c655cbaf9c..82838211af 100644 --- a/LICENSE +++ b/LICENSE @@ -79,8 +79,13 @@ The externally maintained libraries used by Node are: licensed under a permissive free software license. See deps/zlib/LICENSE. - - deps/npm npm is a package manager program copyright 2009, 2010, 2011 + - deps/npm npm is a package manager program copyright 2009 - 2012 Isaac Z. Schlueter and licensed under MIT. npm includes several subpackages MIT or Apache licenses, see deps/npm/LICENSE for more information. npm is included in the Node .msi and .pkg distributions but not in the Node binary itself. + + - tools/doc/node_modules/marked Marked is a Markdown parser Copyright + (c) 2011-2012, Christopher Jeffrey (https://github.com/chjj/). Marked + is used in the generation of node documentation, but not distributed in + any node binaries. diff --git a/tools/doc/LICENSE b/tools/doc/LICENSE new file mode 100644 index 0000000000..e3d4e695a4 --- /dev/null +++ b/tools/doc/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. and other Node 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. diff --git a/tools/doc/generate.js b/tools/doc/generate.js index f866c0120b..af81372532 100755 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -1,4 +1,24 @@ #!node +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. var marked = require('marked'); var fs = require('fs'); diff --git a/tools/doc/html.js b/tools/doc/html.js index 0426198417..63c7c14074 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -1,3 +1,24 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + var fs = require('fs'); var marked = require('marked'); var path = require('path'); diff --git a/tools/doc/json.js b/tools/doc/json.js index 4138fbad30..2459bc26ae 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -1,3 +1,24 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + module.exports = doJSON; // Take the lexed input, and return a JSON-encoded object From daaccc7cb7f4ac208146ef3940fe61c3080fbc16 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 8 Mar 2012 02:57:37 +0100 Subject: [PATCH 3/4] uv: upgrade to 1ac71a31 --- deps/uv/include/uv.h | 5 +++-- deps/uv/src/unix/error.c | 2 ++ deps/uv/src/win/error.c | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index b6ce8ec2e9..fa9812cd59 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -79,7 +79,7 @@ typedef intptr_t ssize_t; XX( 7, EAFNOSUPPORT, "") \ XX( 8, EALREADY, "") \ XX( 9, EBADF, "bad file descriptor") \ - XX( 10, EBUSY, "mount device busy") \ + XX( 10, EBUSY, "resource busy or locked") \ XX( 11, ECONNABORTED, "software caused connection abort") \ XX( 12, ECONNREFUSED, "connection refused") \ XX( 13, ECONNRESET, "connection reset by peer") \ @@ -119,7 +119,8 @@ typedef intptr_t ssize_t; XX( 49, ENAMETOOLONG, "name too long") \ XX( 50, EPERM, "operation not permitted") \ XX( 51, ELOOP, "too many symbolic links encountered") \ - XX( 52, EXDEV, "cross-device link not permitted") + XX( 52, EXDEV, "cross-device link not permitted") \ + XX( 53, ENOTEMPTY, "directory not empty") #define UV_ERRNO_GEN(val, name, s) UV_##name = val, diff --git a/deps/uv/src/unix/error.c b/deps/uv/src/unix/error.c index 93c5ac1f56..071b03affc 100644 --- a/deps/uv/src/unix/error.c +++ b/deps/uv/src/unix/error.c @@ -88,6 +88,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) { case ESRCH: return UV_ESRCH; case ETIMEDOUT: return UV_ETIMEDOUT; case EXDEV: return UV_EXDEV; + case EBUSY: return UV_EBUSY; + case ENOTEMPTY: return UV_ENOTEMPTY; default: return UV_UNKNOWN; } diff --git a/deps/uv/src/win/error.c b/deps/uv/src/win/error.c index 1922f2039b..3f6615f5a5 100644 --- a/deps/uv/src/win/error.c +++ b/deps/uv/src/win/error.c @@ -78,6 +78,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) { case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT; case WSAEWOULDBLOCK: return UV_EAGAIN; case WSAEALREADY: return UV_EALREADY; + case ERROR_LOCK_VIOLATION: return UV_EBUSY; + case ERROR_SHARING_VIOLATION: return UV_EBUSY; case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED; case WSAECONNABORTED: return UV_ECONNABORTED; case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED; @@ -102,6 +104,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) { case ERROR_OUTOFMEMORY: return UV_ENOMEM; case ERROR_NOT_CONNECTED: return UV_ENOTCONN; case WSAENOTCONN: return UV_ENOTCONN; + case ERROR_DIR_NOT_EMPTY: return UV_ENOTEMPTY; case ERROR_NOT_SUPPORTED: return UV_ENOTSUP; case ERROR_INSUFFICIENT_BUFFER: return UV_EINVAL; case ERROR_INVALID_FLAGS: return UV_EBADF; From 3733a85d8d1fa82ca9998fd874f16084801d5db5 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 8 Mar 2012 00:13:44 +0100 Subject: [PATCH 4/4] Windows: include syscall in fs errors --- src/node_file.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 5e0c0ad048..645f44532b 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -49,7 +49,18 @@ using namespace v8; #define THROW_BAD_ARGS \ ThrowException(Exception::TypeError(String::New("Bad argument"))) -typedef class ReqWrap FSReqWrap; +class FSReqWrap: public ReqWrap { + public: + FSReqWrap(const char* syscall) + : syscall_(syscall) { + } + + const char* syscall() { return syscall_; } + + private: + const char* syscall_; +}; + static Persistent encoding_symbol; static Persistent errno_symbol; @@ -86,11 +97,13 @@ static void After(uv_fs_t *req) { // If the request doesn't have a path parameter set. if (!req->path) { - argv[0] = UVException(req->errorno); - } else { argv[0] = UVException(req->errorno, NULL, + req_wrap->syscall()); + } else { + argv[0] = UVException(req->errorno, NULL, + req_wrap->syscall(), static_cast(req->path)); } } else { @@ -206,7 +219,7 @@ struct fs_req_wrap { #define ASYNC_CALL(func, callback, ...) \ - FSReqWrap* req_wrap = new FSReqWrap(); \ + FSReqWrap* req_wrap = new FSReqWrap(#func); \ int r = uv_fs_##func(uv_default_loop(), &req_wrap->req_, \ __VA_ARGS__, After); \ assert(r == 0); \