Conversation
This adds a test for invalid input and solves a TODO by doing so.
Member
Author
danbev
approved these changes
Apr 26, 2018
cjihrig
approved these changes
Apr 26, 2018
trivikr
approved these changes
Apr 26, 2018
Member
Author
|
I just had a closer look how to fix the error messages in e.g., Patchdiff --cc src/node_file.cc
index 89c53afc5b,89c53afc5b..f81433e53c
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@@ -612,7 -612,7 +612,7 @@@ template <typename Func, typename... Ar
inline FSReqBase* AsyncDestCall(Environment* env,
FSReqBase* req_wrap,
const FunctionCallbackInfo<Value>& args,
-- const char* syscall, const char* dest, size_t len,
++ const char* syscall, const char* path, const char* dest, size_t len,
enum encoding enc, uv_fs_cb after, Func fn, Args... fn_args) {
CHECK_NE(req_wrap, nullptr);
req_wrap->Init(syscall, dest, len, enc);
@@@ -621,7 -621,7 +621,7 @@@
if (err < 0) {
uv_fs_t* uv_req = req_wrap->req();
uv_req->result = err;
-- uv_req->path = nullptr;
++ uv_req->path = path;
after(uv_req); // after may delete req_wrap if there is an error
req_wrap = nullptr;
} else {
@@@ -639,7 -639,7 +639,7 @@@ inline FSReqBase* AsyncCall(Environment
const char* syscall, enum encoding enc,
uv_fs_cb after, Func fn, Args... fn_args) {
return AsyncDestCall(env, req_wrap, args,
-- syscall, nullptr, 0, enc,
++ syscall, nullptr, nullptr, 0, enc,
after, fn, fn_args...);
}
@@@ -916,8 -916,8 +916,9 @@@ static void Symlink(const FunctionCallb
FSReqBase* req_wrap_async = GetReqWrap(env, args[3]);
if (req_wrap_async != nullptr) { // symlink(target, path, flags, req)
-- AsyncDestCall(env, req_wrap_async, args, "symlink", *path, path.length(),
-- UTF8, AfterNoArgs, uv_fs_symlink, *target, *path, flags);
++ AsyncDestCall(env, req_wrap_async, args, "symlink", *target, *path,
++ path.length(), UTF8, AfterNoArgs, uv_fs_symlink,
++ *target, *path, flags);
} else { // symlink(target, path, flags, undefinec, ctx)
CHECK_EQ(argc, 5);
FSReqWrapSync req_wrap_sync;
@@@ -942,8 -942,8 +943,9 @@@ static void Link(const FunctionCallback
FSReqBase* req_wrap_async = GetReqWrap(env, args[2]);
if (req_wrap_async != nullptr) { // link(src, dest, req)
-- AsyncDestCall(env, req_wrap_async, args, "link", *dest, dest.length(), UTF8,
-- AfterNoArgs, uv_fs_link, *src, *dest);
++ AsyncDestCall(env, req_wrap_async, args, "link", *src, *dest,
++ dest.length(), UTF8, AfterNoArgs, uv_fs_link,
++ *src, *dest);
} else { // link(src, dest)
CHECK_EQ(argc, 4);
FSReqWrapSync req_wrap_sync;
@@@ -1009,7 -1009,7 +1011,7 @@@ static void Rename(const FunctionCallba
FSReqBase* req_wrap_async = GetReqWrap(env, args[2]);
if (req_wrap_async != nullptr) {
-- AsyncDestCall(env, req_wrap_async, args, "rename", *new_path,
++ AsyncDestCall(env, req_wrap_async, args, "rename", *old_path, *new_path,
new_path.length(), UTF8, AfterNoArgs, uv_fs_rename,
*old_path, *new_path);
} else {
@@@ -1370,7 -1370,7 +1372,7 @@@ static void CopyFile(const FunctionCall
FSReqBase* req_wrap_async = GetReqWrap(env, args[3]);
if (req_wrap_async != nullptr) { // copyFile(src, dest, flags, req)
-- AsyncDestCall(env, req_wrap_async, args, "copyfile",
++ AsyncDestCall(env, req_wrap_async, args, "copyfile", *src,
*dest, dest.length(), UTF8, AfterNoArgs,
uv_fs_copyfile, *src, *dest, flags);
} else { // copyFile(src, dest, flags, undefined, ctx)Sadly, this aborts with the error: It does return the source in the message in this case, but right afterwards it crashes. |
Member
Author
jasnell
approved these changes
Apr 27, 2018
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Apr 29, 2018
This removes outdated TODOs and adds a test for invalid input in `fs.copyFile` and solves a TODO by doing so. PR-URL: nodejs#20319 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Member
Author
|
Landed in 541d219 |
MylesBorins
pushed a commit
that referenced
this pull request
May 4, 2018
This removes outdated TODOs and adds a test for invalid input in `fs.copyFile` and solves a TODO by doing so. PR-URL: #20319 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See commit messages.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes