-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Bug: Start-Trace handles file paths incorrectly #3863
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
Conversation
Start-Trace neglects qualifying arguments to the -o and -pf command line switches, causing logman (and subsequently Start-Trace) to exit with 0x80070057 and return: Error: The argument is incorrect. Whenever arguments to either -ProviderFilePath or -OutputFilePath contain spaces because Start-Trace doesn't escape the path in any way. This commit moves basic input validation for output file paths to the ProviderFilePath and OutputFilePath parameter definitions, and adds text qualifiers (double-quotes) around input arguments
This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a test for this.
Will close if no response to review within a week. |
Apologies for the delay, but I'm unsure of how to structure the test. I can't find any precedent or existing examples for tests with dependencies on Windows-specific external executables. Any guidance would be much appreciated |
I think all you need to do is test Start-Trace with an output file path having spaces (per your repro steps). You can use "$IsWindows" to limit the test to only run on Windows platforms. Do a search for "$IsWindows" to see how other tests restrict to Windows only platforms. @JamesWTruher Do you have any other advice such as where the test should reside? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I don't think a test for this is all that important. This is a good fix to get in.
@IISResetMe Please try to write tests in the future. I've filed an issue for the missing tests. Thanks for the contribution. |
Start-Trace
neglects qualifying arguments to the -o and -pf command lineswitches, causing logman (and subsequently Start-Trace) to exit with error code
0x80070057
and return:This is easy to reproduce on Windows:
This commit moves basic input validation for output file paths to the
ProviderFilePath and OutputFilePath parameter definitions, and adds text
qualifiers (double-quotes) around input arguments