Repository navigation
Glob patterns **/p* incorrectly match on /foo/ap #144458
Copy link
Copy link
Closed
GulajavaMinistudio/vscode-1
#248Closed
Copy link
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugfile-globFile glob engineFile glob enginegood first issueIssues identified as good for first-time contributorsIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersverifiedVerification succeededVerification succeeded
Milestone
Description
Activity
- addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunitiesgood first issueIssues identified as good for first-time contributorsIssues identified as good for first-time contributorsfile-globFile glob engineFile glob engine
on Mar 5, 2022 - changed the title
[-]Glob patterns `**/p*` incorrectly match on `p` anywhere in path[/-][+]Glob patterns `**/p*` incorrectly match on `/foo/ap` anywhere in path[/+]on Mar 5, 2022 - changed the title
[-]Glob patterns `**/p*` incorrectly match on `/foo/ap` anywhere in path[/-][+]Glob patterns `**/p*` incorrectly match on `/foo/ap`[/+]on Mar 5, 2022 - added 2 commits that reference this issue
on Mar 5, 2022 Created a PR #144473 with a possible fix
Reacted by Benjamin Pasero- added a commit that references this issue
on Mar 6, 2022 - addedunreleasedPatch has not yet been released in VS Code InsidersPatch has not yet been released in VS Code Insidersinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insidersand removedunreleasedPatch has not yet been released in VS Code InsidersPatch has not yet been released in VS Code Insiders
on Mar 6, 2022 - locked and limited conversation to collaborators
on Apr 20, 2022
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugfile-globFile glob engineFile glob enginegood first issueIssues identified as good for first-time contributorsIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersverifiedVerification succeededVerification succeeded
VSCode is implement its own solution for glob pattern matching and does not rely on a 3rd party module. The reasons are mostly historic but our glob patterns also behave slightly different compared to others (e.g.
**/foo.txtmatches onfoo.txt, both backslash and slash are supported).Our glob matching works in 2 stages:
**/*.js), we optimize the matching to avoid a regex use (from here)Specifically for the conversion of
**to a regular expression we have a flaw that results in the issue at hand here, the regex is:vscode/src/vs/base/common/glob.ts
Lines 57 to 60 in c7fcb30
Or specifically for
**/p*ends up to be:Unfortunately, given a string of
/foo/ap, the segment[/\\][^/\\]+eagerly matches on/aand as such, the overall result is a match, even though that is unexpected.Help wanted
Opening up for others to contribute, the solution should:
glob.test.ts)[1] however if this is not possible, I am also open for ideas how to solve this differently if the solution is not overly complex.