-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fail gracefully when windows path has quotes or is otherwise invalid #427
Comments
I think the actual bug is that we should not let a bad path entry in the
path stop the search.
Ideally we would log a warning when the path entry is invalid though.
…On Tue, Jun 27, 2017 at 4:53 PM, Appu Goundan ***@***.***> wrote:
Apparently windows paths are allowed to have " in them, see
GoogleCloudPlatform/app-maven-plugin#199
<GoogleCloudPlatform/app-maven-plugin#199>
We probably need to fail a little more gracefully in https://github.com/
GoogleCloudPlatform/appengine-plugins-core/blob/master/src/
main/java/com/google/cloud/tools/appengine/cloudsdk/PathResolver.java
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#427>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHf5HdV1UUKfe9KsjNmcO346Vxjanl3Fks5sIWuvgaJpZM4OHLP6>
.
|
Yes, AFAIK, a path containing |
I believe I used "fail" incorrectly, but path.get seems to throw an exception. |
I'll have to check but I believe the path is invalid. I.e. Windows paths may not contain a double quote. However as @patflynn says we can handle this more gracefully. |
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx confirms that the quote is not legal in Windows paths. |
The doc says you can't create a directory name or a file name containing a quote, which is pretty much expected. However, the situation is that we have quoting in describing a path (e.g., What is important, I think, is that Windows seems to naturally put quotes when defining path environment variables as @lesv said (GoogleCloudPlatform/app-maven-plugin#199 (comment)), so many users might face the same situation. But it's still not clear if it is a fault of some upper layer that should have stripped out the quotes. |
In context this comes directly from the PATH environment variable. Until proven otherwise, I believe this environment variable should not contain quotes. If it does, that's simply an uncommon config error. |
@lesv, are you sure setting an env variable on Windows using the Browse... button puts quotes? In my Windows testing (Windows Server 2016) on GCE, it doesn't put quotes. If it still does, which version do you use? |
It did - Windows 10. |
(I sure didn't put it there) |
Can someone find definitive Windows docs on this? It sounds very strange. |
Note - the fact I saw the double quotes in when setting the path doesn't mean that it put it there on the result. I also tried removing the quotes with edit, and I continued to get the same error message. |
I'm suspecting that whatever is used to split the PATH might be adding the quotes in. |
FYI: not normative but suggestive nonetheless: https://stackoverflow.com/questions/34669912/quotes-in-windows-environment-variable-value |
Elliotte, I think your going about this backwards. I just followed a simple process to add a path. It gave me something that broke our code. Even if Microsoft isn't conforming to its docs, it was still a reasonable path for me to have followed, our users are likely to also experience this. |
Okay, it didn't put quotes when I was modifying a user PATH env var, but I can see that it does put quotes when modifying the system PATH env var: The env variable does contain quotes for my new entry
Then I can reproduce this problem (
What is funny is that, the second time I open the Windows PATH env editor, the editor doesn't show the quotes. |
I'd still like to see normative docs on Windows environment variables so we know how to properly parse this, and what other problems might be lurking. Maybe @csells knows? |
Apparently windows paths are allowed to have
"
in them, see GoogleCloudPlatform/app-maven-plugin#199We probably need to
failignore this a little more gracefully in https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/master/src/main/java/com/google/cloud/tools/appengine/cloudsdk/PathResolver.javaThe text was updated successfully, but these errors were encountered: