Bug: Start-Trace handles file paths incorrectly#3863
Bug: Start-Trace handles file paths incorrectly#3863TravisEz13 merged 2 commits intoPowerShell:masterfrom IISResetMe:master
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. |
PaulHigin
left a comment
There was a problem hiding this comment.
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? |
PaulHigin
left a comment
There was a problem hiding this comment.
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-Traceneglects qualifying arguments to the -o and -pf command lineswitches, causing logman (and subsequently Start-Trace) to exit with error code
0x80070057and 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