-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add fnmatch.h
#3937
Add fnmatch.h
#3937
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
bbbeea4
to
6c55043
Compare
Thanks for the PR! Could you link the relevant headers and/or docs? Also the relevant files in @rustbot author (just comment |
6c55043
to
00ddd05
Compare
Add fnmatch() function and FNM_* constants. Documentation: Header file: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fnmatch.h.html fnmatch() function: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fnmatch.html Signed-off-by: Manos Pitsidianakis <[email protected]>
00ddd05
to
70de2da
Compare
Thank you! Added header file documentation in commit message:
@rustbot review |
cfg_if! { | ||
if #[cfg(any( | ||
target_os = "macos", | ||
target_os = "freebsd", | ||
target_os = "android", | ||
))] { | ||
pub const FNM_PATHNAME: c_int = 1 << 1; | ||
pub const FNM_NOESCAPE: c_int = 1 << 0; | ||
} else { | ||
pub const FNM_PATHNAME: c_int = 1 << 0; | ||
pub const FNM_NOESCAPE: c_int = 1 << 1; | ||
} | ||
} |
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.
Overall this looks pretty straightforward, but do you have links to headers defining these? I am a bit surprised they are opposite on a few OSs, we should make sure that's documented in the PR.
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.
Certainly,
|
https://opensource.apple.com/source/Libc/Libc-825.40.1/include/fnmatch.h.auto.html #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ |
---|---|
|
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ |
|
/** fnmatch() flag to disable backslash escaping. */
#define FNM_NOESCAPE 0x01
/** fnmatch() flag to ensure that slashes must be matched by slashes. */
#define FNM_PATHNAME 0x02 |
|
#define FNM_PATHNAME 0x1
#define FNM_NOESCAPE 0x2 |
|
https://elixir.bootlin.com/glibc/glibc-2.40.9000/source/posix/fnmatch.h#L33 #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ |
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.
Awesome, thanks for the sources!
Add fnmatch() function and FNM_* constants. Documentation: Header file: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fnmatch.h.html fnmatch() function: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fnmatch.html Signed-off-by: Manos Pitsidianakis <[email protected]> (backport <rust-lang#3937>) (cherry picked from commit 70de2da)
FYI, it fails to pass tests on OpenBSD:
for reference: https://github.com/openbsd/src/blob/master/include/fnmatch.h#L43 #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ |
Ah, we need OpenBSD in CI... Are you able to put up a fix? I'll do a new release. |
fix FNM_PATHNAME and FNM_NOESCAPE values.
fix in #3983 |
unbreak OpenBSD after #3937
fix FNM_PATHNAME and FNM_NOESCAPE values. (backport <rust-lang#3983>) (cherry picked from commit 1f68792)
Add
fnmatch()
function andFNM_*
constants.Signed-off-by: Manos Pitsidianakis [email protected]