Skip to content

Commit

Permalink
Avoid using GNU extensions in the dependency splitter regex
Browse files Browse the repository at this point in the history
Sticking to POSIX-compatible extended regular expressions makes the code
more portable.  In particular, this change is required to avoid an abort
at load time on FreeBSD.

No functional change intended.
  • Loading branch information
markjdb committed Aug 28, 2023
1 parent 20b0724 commit 810da5e
Showing 1 changed file with 2 additions and 1 deletion.
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);

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

0 comments on commit 810da5e

Please sign in to comment.