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

Support glob matching on strings. #653

Merged
merged 3 commits into from
Sep 8, 2016
Merged

Support glob matching on strings. #653

merged 3 commits into from
Sep 8, 2016

Conversation

mstemm
Copy link
Contributor

@mstemm mstemm commented Sep 6, 2016

Add new comparison "glob" that allows for glob matching on pathnames, as
implemented by fnmatch(). This handles simple stuff like *, ?, etc. but
not shell specific extensions.

Sound like a good idea @luca, @ldegio @gianlucaborello?

@luca3m
Copy link
Contributor

luca3m commented Sep 6, 2016

Makes sense to me

@gianlucaborello
Copy link
Contributor

Looks cool, but is this going to break Windows?

@mstemm
Copy link
Contributor Author

mstemm commented Sep 6, 2016

Oh right, it will. fnmatch is POSIX only. Is it acceptable to throw an error saying glob is not supported on windows, or should I add an equivalent?

@gianlucaborello
Copy link
Contributor

I'd say the most important thing is to make sure sysdig still compiles, you can judge the effort required for adding the portable code, I don't think it's that important.

@mstemm
Copy link
Contributor Author

mstemm commented Sep 7, 2016

Ok, I added a general function that calls fnmatch on unix and PathMatchSpec on windows. I still need to test the windows build but I'll do that tomorrow.

Committing separate from other changes.
Windows has min()/max() macros that conflict with the
functions from numeric_limits::min()/max(), so disable them via #define
NOMINMAX.
Add new comparison "glob" that allows for glob matching on
pathnames. The glob matching is handled by a utils function glob_match
that calls fnmatch on windows and PathMatchSpec on windows.

This handles simple stuff like *, ?, etc. but not shell specific
extensions.
@mstemm mstemm merged commit 62fdb81 into dev Sep 8, 2016
@mstemm mstemm deleted the glob-filenames branch September 8, 2016 16:16
luca3m pushed a commit that referenced this pull request Oct 10, 2016
* Whitespace diffs.

Committing separate from other changes.

* Fix windows build.

Windows has min()/max() macros that conflict with the
functions from numeric_limits::min()/max(), so disable them via #define
NOMINMAX.

* Support glob matching on strings.

Add new comparison "glob" that allows for glob matching on
pathnames. The glob matching is handled by a utils function glob_match
that calls fnmatch on windows and PathMatchSpec on windows.

This handles simple stuff like *, ?, etc. but not shell specific
extensions.
dmyerscough pushed a commit to dmyerscough/sysdig that referenced this pull request Mar 3, 2017
* Whitespace diffs.

Committing separate from other changes.

* Fix windows build.

Windows has min()/max() macros that conflict with the
functions from numeric_limits::min()/max(), so disable them via #define
NOMINMAX.

* Support glob matching on strings.

Add new comparison "glob" that allows for glob matching on
pathnames. The glob matching is handled by a utils function glob_match
that calls fnmatch on windows and PathMatchSpec on windows.

This handles simple stuff like *, ?, etc. but not shell specific
extensions.
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