Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't honour symbolic links, as writeFile does #5

Closed
avdd opened this issue Nov 2, 2015 · 2 comments
Closed

doesn't honour symbolic links, as writeFile does #5

avdd opened this issue Nov 2, 2015 · 2 comments
Assignees

Comments

@avdd
Copy link

avdd commented Nov 2, 2015

Cause of npm/npm#10223

@iarna iarna self-assigned this Jan 5, 2017
@iarna
Copy link
Contributor

iarna commented Jan 5, 2017

Specifically:

If the destination is a symbolic link fs.writeFile updates the destination of the symbolic link.

Currently writeFileAtomic replaces the symbolic link with an ordinary file.

I think my approach to fixing this would be to use fs.realpath on our destination and use the result of that.

@iarna iarna closed this as completed in f90c7dd Jan 6, 2017
@iarna
Copy link
Contributor

iarna commented Jan 6, 2017

(This is in v1.3.0)

iarna added a commit to npm/npm that referenced this issue Jan 12, 2017
When the target is a symlink, write-file-atomic now overwrites the
_destination_ of the symlink, instead of replacing the symlink itself.  This
makes it's behavior match `fs.writeFile`.

Fixed a bug where it would ALWAYS fs.stat to look up default mode and chown
values even if you'd passed them in.  (It still used the values you passed
in, but did a needless stat.)

Fixes: #10223
Fixes: npm/write-file-atomic#5
Credit: @iarna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants