FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc,fs: keep consistent with fs.link and fs.linkSync by yorkie · Pull Request #3912 · nodejs/node · GitHub

/ node Public

doc,fs: keep consistent with fs.link and fs.linkSync - #3912

Closed
yorkie wants to merge 1 commit into
nodejs:masterfrom
yorkie:improve/fs-doc
Closed

doc,fs: keep consistent with fs.link and fs.linkSync#3912
yorkie wants to merge 1 commit into
nodejs:masterfrom
yorkie:improve/fs-doc

Conversation

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor

So firstly, the destination has a little confusion like I got the log:

Error: EEXIST: file already exists, symlink 'dist/node_modules' -> 'node_modules'

And my source call is:

fs.symlinkSync('dist/node_modules', 'node_modules', 'dir');

Because I thought the first argument stands for destination as the original doc is telling, but it actually is source. Plus, I also make link* and symlinkSync be consistent :-)

targos commented Nov 19, 2015

Copy link
Copy Markdown
Member

In man ln the arguments are called TARGET and LINK_NAME. Perhaps we should be consistent with that and pick target and linkName or just name instead ?

targos added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Nov 19, 2015

Copy link
Copy Markdown
Contributor

man ln will be different across platforms though. On OS X, it is source_file and target_file (or target_dir)

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

Ah, I didn't know it's consistent with man command. BTW, if as @evanlucas said, this behaviors are different across platforms, shouldn't the cross-platform Node.js unify it?

(I'm using OSX).

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

Oh, @targos @evanlucas Why do you reference the command ln, what I have changed on is symlink(2), am I right? After reading at the man symlink, which uses path1 and path2 as below:

A symbolic link path2 is created to path1 (path2 is the name of the file cre-
ated, path1 is the string used in creating the symbolic link). Either name
may be an arbitrary path name; the files need not be on the same file system.

Then now I'm able to understand why the author of this function used destination as the name of 1st one, because the context said there is a pointer to the file described by the 1st one, that we called it source at other function like fs.link.

However, not all Node.js user is such that familiar with Linux like me, then the naming of arguments in fs.link and fs.symlink were really really confused. So I still proposal that keep consistent with fs.link's naming rule, any thoughts?

Copy link
Copy Markdown
Contributor

Ahhh good point. I think that this is less confusing than the current documentation.

LGTM

Comment thread doc/api/fs.markdown Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You also need to update mentions of "destination path" here.

targos commented Nov 19, 2015

Copy link
Copy Markdown
Member

Fair enough, I didn't get that the point was to make it consistent with fs.link, sorry !

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

Never mind @targos, fixed nits and updated the naming in source files, LGTY too?

targos commented Nov 19, 2015

Copy link
Copy Markdown
Member

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

BTW, I found a typo of errors in fs.link and created a new PR at #3917 :-)

jasnell commented Nov 19, 2015

Copy link
Copy Markdown
Member

@yorkie ... awesome. This LGTM but curious what @nodejs/ctc would think about the semver-iness of this change. It seems like a fairly significant mismatch between the docs, the API and the implementation in JS.

Also, minor nit, can you please update the title of the PR to be doc,fs: to reflect that it's a change to both the doc and the fs module?

jasnell commented Nov 19, 2015

Copy link
Copy Markdown
Member

I'm going to mark this semver-major for now as a precaution.

jasnell added the semver-major PRs that contain breaking changes and should be released in the next major version. label Nov 19, 2015
yorkie changed the title doc: keep consistent with fs.link and fs.linkSync doc,fs: keep consistent with fs.link and fs.linkSync Nov 19, 2015

yorkie commented Nov 19, 2015

Copy link
Copy Markdown
Contributor Author

Done :-)

yorkie commented Nov 23, 2015

Copy link
Copy Markdown
Contributor Author

How is this going? is the CI happy now? This seems to be suspended over 4 days :-)

Copy link
Copy Markdown
Contributor

Just to be clear, this change won't break any existing code or will it?

Copy link
Copy Markdown
Contributor

The documentation change is incorrect. I reverted a similar change in in 5843ae8.

Copy link
Copy Markdown
Contributor

Let me clarify a bit, too.

symlinkSync(destination, path) creates a symbolic link at path which points at destination.

If this patch gets landed, it becomes this:

symlinkSync(srcpath, dstpath) creates a symbolic link at dstpath which points at srcpath.
I find that wording very confusing, I (and I think most people) would assume the source to point at the destination, and not the other way round.

If the fs.link() documentation is unclear, I would prefer to see that fixed rather than applied to other documentation sections.

yorkie commented Nov 24, 2015

Copy link
Copy Markdown
Contributor Author

Thanks @piscisaureus and now I have some explanations more about this question, the following is a description from man link/ln:

Given one or two arguments, ln creates a link to an existing file source_file.

The above manual seems to use source to stand for the existing file, and the below is also from manual:

How a link points to a file is one of the differences between a hard and symbolic link.

So I think the file pointed from the link should be unified by this manual.

creates a symbolic link at dstpath which points at srcpath

@piscisaureus as you said, I correct your words as: creates a symbolic link/pointer to the source_file, and this link/pointer is named by target_file, so I'm proposing that Node.js should use target instead of dest in link, symlink.

targos commented Nov 24, 2015

Copy link
Copy Markdown
Member

creates a symbolic link/pointer to the source_file, and this link/pointer is named by target_file

It's not that easy. In the Linux doc, target is used for the path that the symlink points at: http://man7.org/linux/man-pages/man2/symlink.2.html

Copy link
Copy Markdown
Contributor

@piscisaureus as you said, I correct your words as: creates a symbolic link/pointer to the source_file, and this link/pointer is named by target_file, so I'm proposing that Node.js should use target instead of dest in link, symlink.

A symbolic link points to another path. There doesn't actually need to be a file there. I think "target" is an appropriate name for the path that the symbolic link points to.

link() is different in the sense that it doesn't point at another path - it adds a new name for a file that already exists. It has more in common with rename(old_name, new_name) than it has with symlink - the difference being that link adds a name and rename changes the name. So I would suggest the link docs be made consistent with rename rather than symlink.

You can see the linux man pages do the same thing:

versus

yorkie commented Nov 25, 2015

Copy link
Copy Markdown
Contributor Author

@piscisaureus I do that agree with you 100%, and I now updated my commits to use target instead of destination. Could you take a look again, thank you guys :-)

Copy link
Copy Markdown
Contributor

LGTM. Thanks for your patience @yorkie!

Copy link
Copy Markdown
Contributor

LGTM if CI is happy.

CI: https://ci.nodejs.org/job/node-test-pull-request/844/

Copy link
Copy Markdown
Contributor

@yorkie CI doesn't seem to be happy with this change.

https://ci.nodejs.org/job/node-test-commit-osx/1298/nodes=osx1010/console

yorkie commented Nov 25, 2015

Copy link
Copy Markdown
Contributor Author

Sorry, I guess I have something forgot to update, I will check it again, sorry :-)

jasnell removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 1, 2015

targos commented Dec 1, 2015

Copy link
Copy Markdown
Member

That's right

jasnell commented Dec 1, 2015

Copy link
Copy Markdown
Member

@Trott +1... label removed

jasnell commented Dec 1, 2015

Copy link
Copy Markdown
Member

LGTM
(sorry for the delay reviewing @yorkie , just catching up after vacation ;-) )

targos commented Dec 1, 2015

Copy link
Copy Markdown
Member

LGTM

yorkie commented Dec 1, 2015

Copy link
Copy Markdown
Contributor Author

Btw, if semver is right to marjor, when this would get this merged? Does this get documented?

yorkie commented Dec 1, 2015

Copy link
Copy Markdown
Contributor Author

Thank you guys :-)

yorkie commented Dec 5, 2015

Copy link
Copy Markdown
Contributor Author

Ping guys

Trott commented Dec 5, 2015

Copy link
Copy Markdown
Member

yorkie commented Dec 6, 2015

Copy link
Copy Markdown
Contributor Author

@Trott Why create a new CI? because I didn't push any changes to the last CI.

Trott commented Dec 6, 2015

Copy link
Copy Markdown
Member

Whoops, my mistake.

targos commented Dec 6, 2015

Copy link
Copy Markdown
Member

@yorkie your last push was 10 days ago, it can be possible that new commits on master make the changes in this PR fail

Trott commented Dec 6, 2015

Copy link
Copy Markdown
Member

FWIW, the latest CI passed except for known-flaky tests on Windows (including one that would be fixed by #4062, hey someone go look at that and give it an LGTM if you're comfy with the change, will ya?).

Trott pushed a commit that referenced this pull request Dec 6, 2015
PR-URL: #3912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

Trott commented Dec 6, 2015

Copy link
Copy Markdown
Member

Landed in 8c35903

(The patch didn't apply cleanly on fs.markdown so check my work carefully on that one to make sure I didn't mess anything up.)

Trott closed this Dec 6, 2015
yorkie deleted the improve/fs-doc branch December 6, 2015 05:51

yorkie commented Dec 6, 2015

Copy link
Copy Markdown
Contributor Author

@Trott I guess you missed to add @trevnorris to reviewers list at 8c35903

yorkie commented Dec 6, 2015

Copy link
Copy Markdown
Contributor Author

Never mind, that's my fault, thank you Trott :-)

rvagg pushed a commit that referenced this pull request Dec 8, 2015
PR-URL: #3912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
rvagg mentioned this pull request Dec 17, 2015
MylesBorins pushed a commit that referenced this pull request Dec 29, 2015
PR-URL: #3912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
PR-URL: #3912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
PR-URL: nodejs#3912
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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

Labels

doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL