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

Windows network drives not always matched by net use regex #12948

Closed
7 tasks done
stephenlrandall opened this issue Apr 22, 2023 · 2 comments · Fixed by #12949
Closed
7 tasks done

Windows network drives not always matched by net use regex #12948

stephenlrandall opened this issue Apr 22, 2023 · 2 comments · Fixed by #12949
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) windows only

Comments

@stephenlrandall
Copy link
Contributor

Describe the bug

The Windows network drive check implemented in this PR uses the following regular expression:

const parseNetUseRE = /^(\w+) +(\w:) +([^ ]+)\s/

This assumes a non-empty status from the net use command, which is not always the case. I don't know what causes certain valid mapped drives to not show up with a status, but you can see an example in this article although it's not called out.

Because of this, Vite cannot always correctly resolve paths for valid mapped network drives. Making the status check in the regex optional fixes the issue:

const parseNetUseRE = /^(\w+)? +(\w:) +([^ ]+)\s/

Reproduction

not possible with repo alone

Steps to reproduce

Create a mapped network drive that gives no status when checked with net use. (No idea why this happens or how to do it on purpose.) Attempt to run Vite from that mapped drive.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (6) x64 Intel(R) Xeon(R) CPU E7-4870 v2 @ 2.30GHz
    Memory: 5.69 GB / 12.00 GB
  Binaries:
    Node: 18.1.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.8.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (111.0.1661.41)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vite: 4.3.0 => 4.3.0

Used Package Manager

npm

Logs

Click to expand!
failed to load config from <network drive>:<repo path>\vite.config.js
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<network drive>:<!!network drive path, repeated!!><repo path>\node_modules\svelte\store\index.mjs' imported from <network drive>:<repo path>\vite.config.js.timestamp-1682168805046-b61e4fd57df9b.mjs
    at new NodeError (node:internal/errors:377:5)
    at finalizeResolution (node:internal/modules/esm/resolve:405:11)      
    at moduleResolve (node:internal/modules/esm/resolve:966:10)
    at defaultResolve (node:internal/modules/esm/resolve:1174:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:605:30)        
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)   
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)    at link (node:internal/modules/esm/module_job:78:36)

Validations

@patak-dev
Copy link
Member

Thanks for digging into the code @stephenlrandall! would you do a PR with this change?

@patak-dev patak-dev added windows only p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Apr 22, 2023
@stephenlrandall
Copy link
Contributor Author

stephenlrandall commented Apr 22, 2023

@patak-dev #12949. Hopefully got the formatting conventions correct, and I wasn't sure where to correctly add a test for this change.

@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) windows only
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants