Uh oh!
There was an error while loading. Please reload this page.
test: make realpath tests case-insensitive on win32 - #17
Conversation
bnoordhuis
commented
Nov 30, 2014
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
15de721Comparervagg
commented
Nov 30, 2014
typo fixed, thanks for picking that up! |
d7e65ff to
185d11cCompareseishun
commented
Dec 5, 2014
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. |
seishun
commented
Dec 5, 2014
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? |
rvagg
commented
Dec 6, 2014
Alternatively I could just change my commit so that it only does a |
seishun
commented
Dec 6, 2014
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. |
rvagg
commented
Dec 6, 2014
@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. |
piscisaureus
commented
Dec 6, 2014
+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. |
piscisaureus
commented
Dec 6, 2014
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. |
seishun
commented
Dec 6, 2014
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. |
piscisaureus
commented
Dec 6, 2014
Whatever is easiest.
Certainly! Windows couldn't care less. |
rvagg
commented
Dec 6, 2014
needs to be closed if #100 gets merged |
bnoordhuis
commented
Dec 9, 2014
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.