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

Avoid using GNU extensions in the dependency splitter regex #1617

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion libdnf/repo/DependencySplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

namespace libdnf {

// Avoid using the \s and \S patterns here as they are GNU extensions and aren't portable.
static const Regex RELDEP_REGEX =
Regex("^(\\S*)\\s*(<=|>=|<|>|=|==)?\\s*(\\S*)$", REG_EXTENDED);
Regex("^([^[:space:]]*)[[:space:]]*(<=|>=|<|>|=|==)?[[:space:]]*([^[:space:]]*)$", REG_EXTENDED);
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. It's never come to my mind that there might be a compatibility problem with '\s'.
Does it make sense to leave a comment here? Just to remind future maintainers who might feel tempted to "simplify" the regex by putting \s back.

Would you mind filing a similar PR also for dnf5 (next generation of dnf)?
https://github.com/rpm-software-management/dnf5/blob/e2aa5eead7589e65994b2f971f63d5d64b88d421/libdnf5/solv/reldep_parser.cpp#L30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it make sense to leave a comment here?

Sure, I updated the diff.

Would you mind filing a similar PR also for dnf5 (next generation of dnf)?

Certainly: rpm-software-management/dnf5#843


static bool
getCmpFlags(int *cmp_type, std::string matchCmpType)
Expand Down