Skip to content
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

FindMatch() not working if pattern contains box bracket characters #585

Closed
vinodkumar3 opened this issue Nov 4, 2019 · 7 comments
Closed
Assignees

Comments

@vinodkumar3
Copy link

Please check our current Issues to see if someone already reported this https://github.com/Microsoft/azure-pipelines-task-lib/issues

Environment

azure-pipelines-task-lib version: 2.8.0

Issue Description

FindMatch() is unable to find matching pattern if input pattern contains box bracket ('[' or ']') characters.

Logs

Logs are attached with this issue.

@damccorm
Copy link

damccorm commented Nov 4, 2019

We use minimatch to find things. I believe [ and ] are special characters, so escaping should fix the problem

@vinodkumar3
Copy link
Author

@damccorm
Tried modifying the task and found out that in case of special characters, escaping is working with Ubuntu agents but not with Windows. Seems something related to back or forward slashes in file paths.
I can see a related issue NuGet/Home#3584 with Glob pattern.

@damccorm
Copy link

damccorm commented Nov 5, 2019

Could you share your repro? Minimatch should be able to handle that I believe, if I'm understanding the issue correctly.

@damccorm damccorm self-assigned this Nov 5, 2019
@damccorm
Copy link

@vinodkumar3 any update?

@vinodkumar3
Copy link
Author

PFA logs with updated ARM task (added modification of escaping special characters in file path, '[' & ']' in this example) where Ubuntu is correctly finding the path but Windows doesn't.

ububtu-escape.zip
windows-escape.zip

@damccorm
Copy link

It looks to me like you're escaping incorrectly on windows.
On Ubuntu, the pattern is: /home/vsts/work/1/s/a \[abc\] Subscription Deploy/resourcegroup.json
On windows, its: d:\a\1\s\a \[abc\] Subscription Deploy\resourcegroup.json

Note that in the windows version, the way you currently have it escaped there's no way to distinguish between a path seperator (\) and the escaping backslash.

With that said, escaping minimatch on Windows is weird, see - isaacs/node-glob#212. We have docs on how to do this here.

@vinodkumar3
Copy link
Author

@damccorm
Thanks for pointing me to the right documentation. This is something I was missing. You may close the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants