-
Notifications
You must be signed in to change notification settings - Fork 3
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
Replace PathMap.normalisePath with the one from alhadis.utils #1
Conversation
Oh! Thanks for the clarification there - didn't realize that :D This particular problem has been reported by users of https://github.com/facebook/nuclide as we use non-standard URLs (e.g. |
`PathMap` currently has a different `normalisePath` implementation from the one that the `Resource` class uses, leading to a mismatch between `PathMap` keys and resource paths. This can lead to bugs where a resource is marked as disposed but not removed from the `PathMap`; attempting to fetch it again leads to exceptions from the null `icon`.
Updated the PR with an alternate fix.. let me know if that would work.
|
Ohhhh... damn, that explains everything. See, I didn't factor in URIs when I originally wrote the The reason for the breakage is, of course, that the leading protocol component is interpreted as a local directory. The fact that it's non-standard ( I'll be back in front of a laptop in about an hour or so, but it lacks a GUI (OpenBSD 6.2 and Intel hardware aren't getting along...), so I'll push a fix to your branch and get you to verify that it works for me. Have you made your branch editable by maintainers? |
Thank you, yes it is editable! Note that I think it's OK that the URIs are
parsed correctly; as long as they're both normalized incorrectly *but in
the same way* everything seems to work fine (all the code to read/check
files wouldn't work with remote URIs anyway :p)
…On Mon, Dec 18, 2017 at 12:09 AM John Gardner ***@***.***> wrote:
as we use URLs (e.g. nuclide://hostname/home/hansonw/test.txt)
Ohhhh... damn, that explains everything. See, I didn't factor in URIs when
I originally wrote the normalisePath function, because its chief purpose
was to alleviate the headaches of dealing with Windows path separators. The
PathMap class was also authored for the same purpose.
The reason for the breakage is, of course, that the leading protocol
component is interpreted as a local directory. The fact that it's
non-standard (nuclide://) has zero bearing on the input's interpretation:
you'd get the same breakages and inconsistencies if if were, say, file://.
I'll be back in front of a laptop in about an hour or so, but it lacks a
GUI (OpenBSD 6.2 and Intel hardware aren't getting along...), so I'll push
a fix to your branch and get you to verify that it works for me. Have you
made your branch editable by maintainers?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAjPYoTB_kM6A69TM-xpB_Xlh0nKKpRgks5tBh3HgaJpZM4REcIp>
.
|
The original `normalisePath` function was written specifically for paths only. Well-formed URIs (those beginning with a `protocol://`) were never taken into consideration, and are being incorrectly normalised like file paths (e.g., `foo://bar` becoming `foo:/bar` instead).
Honestly, I don't think well-formed URIs should even be normalised like ordinary paths. They're the exception rather than the norm, and it should be assumed that the author knows what they're doing. I realised as I was writing this that URIs should be exempt from the case insensitivity check as well (because a remote resource might be hosted on a case-sensitive filesystem, while the local machine is running macOS or whatever). I've pushed to your branch, give it a whirl. :D |
Hahah! No spare monitors lying around? :( Agreed that URIs should not be normalized at all! However the amended commit doesn't fix things, as It seems like the right fix would be to both use a consistent normalisation function everywhere in addition to fixing the function |
(Nope, no spare screens lying around. 😢 I'm wayyyy too poor for that). I've pushed an analogous modification to the To test the change locally, you'll need to |
That seems to work! (I think there's a missing close paren |
Holy shit, great catch. 😥 Emacs doesn't balance bracket-pairs like Atom does, and this makes the third (or fourth) time I forgot to type a closing brace because I unconsciously expected it to be inserted as I typed. Thanks, muscle memory. 😀 I've force-pushed an amended commit. I should
Yes, that's true. Keep in mind the standalone function was written well-before The latter was also churned out in a hurry, and I didn't want to introduce any last-minute complications by altering the logic of existing code. Do you foresee this being an issue...? |
Not having identical output is the cause of this issue in the first place ;) Otherwise we never would have noticed, despite the incorrect URL handling and all! But it would certainly solve the problem for us if you pushed the change as-is. Thank you! |
Done and done! Thanks for your patience! |
PathMap
currently has a differentnormalisePath
implementation fromthe one that the
Resource
class uses, leading to a mismatch betweenPathMap
keys and resource paths. This can lead to bugs where aresource is marked as disposed but not removed from the
PathMap
;attempting to fetch it again leads to exceptions from the null
icon
.