Repository navigation
Space in network share name(UNC path) causes unknown error #5160
Description
Activity
- addedmoduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
on Feb 9, 2016 @orangemocha ... any ideas?
I tried locally on a Windows 2008 R2 machine with a share from the same, and I can't reproduce the issue with Node v5.5.0 nor with the current master. @MadLittleMods could you try a similar test? I suspect this might be specific to networks shares from OSX machines.
@orangemocha theory of OSX shares not playing nice with Windows seems plausible given the results below.
Local file shares (same machine) on Windows 10 with
node@5.5.0ornode@5.9.0work correctly:> node "\\MLM-DESKTOP-PC\file share with spaces1\foo.js" foo > node "\\MLM-DESKTOP-PC\file-share-test1\foo.js" fooAccessing those Windows 10 machine shares on another Windows 8.1 with
node@4.1.2ornode@5.9.0machine work correctly:> node "\\MLM-DESKTOP-PC\file share with spaces1\foo.js" foo > node "\\MLM-DESKTOP-PC\file-share-test1\foo.js" fooAccessing Windows 8.1 machine shares on Windows 10 machine with
node@5.9.0work correctly:> node "\\MLM-PC\file share with spaces2\foo.js" foo > node "\\MLM-PC\file-share-test2\foo.js" fooIndeed it sounds plausible. Thanks for verifying, @MadLittleMods !
I don't have an OSX machine with me so I can't test this. I'll add it to our queue of things to investigate. If someone else wants to dive a bit deeper, I would suggest setting a breakpoint and stepping in through the stat implementation in libuv (
) and to find out what error is being returned. Once we know the error code, a web search should reveal if it's a known issue with OSX and SMB, and if there are any known solutions.Lines 1160 to 1199 in 2c67289
INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { HANDLE handle; DWORD flags; flags = FILE_FLAG_BACKUP_SEMANTICS; if (do_lstat) { flags |= FILE_FLAG_OPEN_REPARSE_POINT; } handle = CreateFileW(req->file.pathw, FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, flags, NULL); if (handle == INVALID_HANDLE_VALUE) { SET_REQ_WIN32_ERROR(req, GetLastError()); return; } if (fs__stat_handle(handle, &req->statbuf) != 0) { DWORD error = GetLastError(); if (do_lstat && error == ERROR_SYMLINK_NOT_SUPPORTED) { /* We opened a reparse point but it was not a symlink. Try again. */ fs__stat_impl(req, 0); } else { /* Stat failed. */ SET_REQ_WIN32_ERROR(req, GetLastError()); } CloseHandle(handle); return; } req->ptr = &req->statbuf; req->result = 0; CloseHandle(handle); } +1
Using windows 10 and osx 10.11.4I am able to reproduce the error. But interestingly, the error does not occur for any normal shared folder, whether or not it has a space in the name. The only way I can reproduce the error is with a Macintosh HD share. There must be something different about how the Macintosh HD is shared over SMB. I'll try to debug as @orangemocha suggested above.
Submitted PR libuv/libuv#996
Reacted by upqReacted by Eric EastwoodThe libuv PR landed. I'm reopening the issue until we upgrade the bundled libuv.
Curious how you track when the libuv dependency gets upgraded and bundled in order to know when this issue should be closed?
Does this issue need the
libuvlabel?- addedlibuvIssues and PRs related to the libuv dependency or the uv binding.Issues and PRs related to the libuv dependency or the uv binding.
on Aug 16, 2016 Curious how you track when the libuv dependency gets upgraded and bundled in order to know when this issue should be closed?
It's an artisanal process :-) Basically, when we get an issue or PR in libuv which comes from Node, we reference it in the commit message. Then, when the upgrade PR is made to Node we just
git logand copy all theFixes:links which point to Node into the PR metadata. That way the upgrade PR will close this.It's a bit unfortunate that GitHub closes issues cross-repo if you have commit access to both, so we have to remember to re-open issues. Or we could switch to
Refs:, but this is actually a fix, so...Does this issue need the libuv label?
Yeah, added it!
- added a commit that references this issue
on Aug 18, 2016 Just a friendly check-in. Does the bundle have an upgraded libuv now?
libuv was updated to 1.10.0 a few days ago. It's available on the master branch, but hasn't gone out in a release yet.
This is outdated and can be closed.
@jasongin, I encountered a similar issue with Node.js and hierarchical storage management software -
something like Microsoft GVFS.Because my fix touches this same libuv code, I attempted to reproduce this issue to confirm that the workaround is not affected, but I cannot make
uv_fs_lstatfail in the same way reported here.First, I adapted a libuv test in
test-fs.cto lstat a file on a MacBook Pro over SMB using path\\10.90.240.79\Macintosh HD\test.js. Stepping in the debugger, I found that this did not trigger your workaround:ERROR_NOT_A_REPARSE_POINTwas not returned byDeviceIoControl.I also tried testing the same version of Node.js reported in this issue using
nvs run 5.5.0 "\\10.90.240.79\Macintosh HD\test.js", but that succeeded without the exception reported above.My PC is running Windows 10 build 15063.540 and the MacBook Pro is running macOS Sierra 10.12.3.
Are you still able to reproduce the issue on recent Windows builds, and if so do you have any suggestions as to what step I might be missing? Thanks!
A network-share/UNC path with a space in the name throws
Error: UNKNOWN: unknown error, lstat [...]when trying to run a node scriptnode "\\ERIC-MACBOOK\Macintosh HD\foo.js".I ran into this situation after setting up file sharing on OSX and trying to run commands on the
Macintosh HDshare.Using a network share that doesn't have a space in the name works just fine; Tested with share that points to user directory on the OSX machine and a separate NAS. It doesn't seem to matter if there are spaces in the rest of the path, just the share name.
Summary
node "\\ERIC-MACBOOK\Macintosh HD\foo.js": ThrowsError: UNKNOWN: unknown error, lstat [...]node "\\ERIC-MACBOOK\eric\foo.js": Works normallynode "\\some-nas\mlm\foo.js": Works normallyTerminal/CLI output
Running on Windows 10.
On Windows, the
pushdcommand will map a UNC path to a temporary drive letter. Just wanted to see if it made a difference because it eliminates the space in the path used. But is probably just a pointer to the UNC path with space anyway and why it causes similar errors.\\ERIC-MACBOOK\Macintosh HD\\\ERIC-MACBOOK\eric\Related issues: