Skip to content

Conversation

@Thom1729
Copy link
Member

@Thom1729 Thom1729 commented Apr 4, 2021

For #134.

After much research and testing, I determined that the fundamental bug was that every pattern component except for ** should match at least one character — so /A*B/ should match AB, but A/* shouldn't match A/. This behavior should match other glob engines and resolve the linked bug.

This behavior varies slightly from sublime.find_resources('*'), which will find all resources (like sublime.find_resources('').

It's probably bad news for other reasons if sublime.find_resources() returns directories, but at least now it shouldn't be bad news for us in particular.

@Thom1729
Copy link
Member Author

Thom1729 commented Apr 4, 2021

N.B. In order to directly test #134, we'd have to create a zipfile with directory entries, which I'm not sure how to do within Python.

@FichteFoll
Copy link
Member

FichteFoll commented Apr 6, 2021

N.B. In order to directly test #134, we'd have to create a zipfile with directory entries, which I'm not sure how to do within Python.

Yeah, I tried writing such a file with the zipfile module, but you can't create "files" with trailing slashes.
I suppose we need to bundle such a zip as an artifact.

self._test_matches(
'Foo/**',
[
'Packages/Foo/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we match this at all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because a UNIX glob would and I don't think we need to deviate. It's a corner case that probably won't come up very often, but if it does then I think handling it like a UNIX glob is the least surprising thing to do.

@FichteFoll FichteFoll added this to the 1.4.1 milestone Apr 6, 2021
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
@Thom1729
Copy link
Member Author

Thom1729 commented Apr 6, 2021

I suppose we need to bundle such a zip as an artifact.

Ugh. You're probably right, but still ugh. I've opened a question on Stack Overflow looking for an alternative.

@Thom1729
Copy link
Member Author

Thom1729 commented Apr 7, 2021

Do you think this can be merged as-is, punting the direct zipfile test to a future PR?

Copy link
Member

@FichteFoll FichteFoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can merge this.

@Thom1729 Thom1729 merged commit 3398369 into master Apr 8, 2021
@Thom1729 Thom1729 deleted the fix-glob-bug branch April 8, 2021 04:56
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

Successfully merging this pull request may close these issues.

3 participants