joyent/node — pull request #8657 by vkurchatkin (2014-11-01 10:33:01+00:00)
Title: fs: fix symlink error message

There is a problem with argument naming: which one is `dest` and which one is `src`?

In docs:

```
fs.link(srcpath, dstpath, callback)
fs.symlink(srcpath, dstpath[, type], callback)
```

In JS:
```javascript
fs.link = function(srcpath, dstpath, callback) {}
fs.symlink = function(destination, path, type_, callback) {}
```

In CC:

Link:

```cpp
if (!args[0]->IsString())
return TYPE_ERROR("dest path must be a string"); // <- so first is dest now
if (!args[1]->IsString())
return TYPE_ERROR("src path must be a string"); // <- src

// but later

node::Utf8Value orig_path(args[0]);
node::Utf8Value new_path(args[1]); // <-src

SYNC_DEST_CALL(link, *orig_path, *new_path, *orig_path, *new_path)
// supposed to be (func, path, dest, ...), so dest=new_path
```

Symlink:

```cpp
if (!args[0]->IsString()) // <- dst
return TYPE_ERROR("dest path must be a string");
if (!args[1]->IsString()) // <- src
return TYPE_ERROR("src path must be a string");

...

node::Utf8Value dest(args[0]);
node::Utf8Value path(args[1]);

...

SYNC_DEST_CALL(symlink, *path, *dest, *dest, *path, flags)

```

So, here everything is consistent, but destination means the opposite thing.

Fixes #8651, #4314, #5381

/cc @indutny @joliss