-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: make realpath tests case-insensitive on win32 #17
Conversation
The change LGTM but it would be good to get confirmation from someone like @piscisaureus or @seishun on whether this is a bug or merely a bad assumption in the test. There's a small but persistent typo in the commit log: s/case-insensntive/case-insensitive/ |
process.cwd(), which is used in lots of the tests, may return a different value than what realpath will return even though they are the same path when compared case-insensitive.
0dde0bc
to
15de721
Compare
typo fixed, thanks for picking that up! |
d7e65ff
to
185d11c
Compare
With this change realpath will pass the tests even if it gives you "c:\PROGRAM files\nodeJS" instead of "C:\Program Files\nodejs". While the two paths are equivalent in Windows, only the latter is displayed in cmd etc and thus should be expected from a function that returns a "canonicalized pathname". I believe the real problem here is that realpath currently gives you lowercase drive letters. We should fix that, not the tests. |
It turns out the rabbit hole goes quite deep. Here's how it went: 18 Mar 2013: nodejs/node-v0.x-archive@a05f973 changes capitalization of drive letter in path.normalize for reasons no one knows So now we have two problems. Should we just revert both commits? |
Alternatively I could just change my commit so that it only does a |
No, the drive letter should be uppercase. The test is fine.
Isn't that when you fix the implementation? :)
Maybe, but to me the behavior "give the path that Windows displays" seems obvious. In any case, I see no downside in guaranteeing that the drive letter will be uppercase. It's way better than forcing the user to call toLowerCase on everything. |
@seishun would you mind putting in a pull request to change the implementation along with a new test case specifically for it, then we can discuss further over here. I was just taking the short path but am happy to defer if there is a strong enough opinion on this from someone else. |
+1 on reverting both. Verzonden van mijn HTC ----- Reply message ----- It turns out the rabbit hole goes quite deep. Here's how it went: 18 Mar 2013: nodejs/node-v0.x-archive@a05f973nodejs/node-v0.x-archive@a05f973 changes capitalization of drive letter in path.normalize for reasons no one knows So now we have two problems. Should we just revert both commits? Reply to this email directly or view it on GitHubhttps://github.com//pull/17#issuecomment-65869241. |
Clearly I disagree that the drive letter should be uppercase. Instead I prefer not to change it at all, just like we don't enforce a particular casing on any other path component. It would be kind of nice if realpath() could return the actual on-disk case that has been stored on a case preserving filesystem. However that's not possible on Windows afaik and I am not sure about OS X either. |
I just played around with
Can the drive letter even be lowercase on Windows? Anyway, path.resolve uses process.cwd() internally which should just give you whatever Windows thinks the actual path is. |
Whatever is easiest.
Certainly! Windows couldn't care less. |
needs to be closed if #100 gets merged |
This has been addressed by e24fa83, if I'm not mistaken. |
Just ran in to this on Windows when running manually.
process.cwd()
, which is used in lots of the tests, may return a different value than what realpath will return even though they are the same path when compared case-insensitive.