-
Notifications
You must be signed in to change notification settings - Fork 8.1k
CommandSearcher: treat invalid wildcard path as literal #7399
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
iSazonov
left a comment
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.
Leave a comment
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. |
|
@SteveL-MSFT do we have interest in the change? |
|
@iSazonov yes, I think this change is something we want |
|
@kwkam Please rebase to pass CIs. |
|
@iSazonov OK, rebased to latest master. |
daxian-dbw
left a comment
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.
ContainsWildcardCharacters is a public method in WildcardPattern. Changing to the behavior is a breaking change. The method name clearly indicates that it only checks if the string contains any wildcard characters, but not if it contains valid wildcard characters. If we need to check for valid wildcard characters, a new method should be introduced.
Does the comment only refer to this method or its use too? |
The comment only applies to the method, not to its uses. If a caller assumes differently, then another method should be added for checking if a path contains valid wildcard characters. |
|
I think the breaking change is in gray area because using of the method implies that we want exactly working wildcards and not something similar ']['. Also I'd said that passing '][' in the method is a bug. |
|
@iSazonov This is more of a unacceptable changes in public contract. Quoted from the breaking-chagne-doc:
That being said, I do like the refactoring changes in |
|
Add the "Review-Committee" label. The proposed change is a breaking change that falls in bucket 1, so we need committee to review. |
|
@PowerShell/powershell-committee reviewed this. Recommendation is to deprecate this api and introduce |
|
Should the new method be a strict checking (e.g. try/catch with the WildcardPatternParser::Parse)? |
|
At first glance it should be |
|
The method Even for the callers that do want the accurate answer, another call to We can still add the new method |
|
@kwkam Changes regarding |
|
I full agree with @daxian-dbw. |
|
@kwkam Do you agree with @daxian-dbw suggestion to split the PR? |
Do not glob path with invalid wildcard pattern (eg. "./[.ps1"). Merge the path resolving code from GetNextFromPath into ResolvePSPath. Add test for previous change engine/regex: add MayBeWildcardPattern CommandSearcher: use MayBeWildcardPattern [Feature] Fix FunctionProvider test [Feature] Revert "[Feature] Fix FunctionProvider test" This reverts commit d7ab0d7d538df8943bf156f098866cbf7b38bc64. [Feature] Remove 'resolvedPath != null' [Feature] Redo efe93252c5 and b300130e59 [Feature] fixup Revert "[Feature] fixup" Revert "[Feature] Redo Rename MayBeWildcardPattern Fix ContainsValidWildcardPattern
|
rebased PR |
|
@PoshChan Please remind me in 1 hour |
|
@TravisEz13, this is the reminder you requested 1 hour ago |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
@daxian-dbw Please update your review |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
@daxian-dbw Please update your review |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
PR Summary
Do not glob path with invalid wildcard pattern (eg. "./[.ps1").
PR Motivation
Merge the Qualified Path Search and Relative Path Search into a single function (
GetNextFromPathintoResolvePSPath).Add an internal method
ContainsValidWildcardPatternto the WildcardPattern API to make the checking be more sensitive to invalid bracket patterns, to allow faster fallback from wildcard search for fully qualified path to a literal search.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests