diff options
author | Stefan R <kroko87@hotmail.com> | 2019-02-11 13:07:56 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@alpinelinux.org> | 2019-03-05 15:56:54 +0000 |
commit | 7f90328d3f882f558e1a22830974308c31fef713 (patch) | |
tree | b04dea3c2ee2d2f68a5f33a39346c4b6faf60101 /testing/snapper/regex.patch | |
parent | ea7dc18423e0a5abcb98e7fedf1188a0b86a4905 (diff) |
testing/snapper: config and musl fixes
Add dbus as dependency.
Readd dbus config files in remove-systemd.patch.
Fix conjob paths in scripts/Makefile.am.
Install data/sysconfig.snapper to /etc/conf.d/snapper.
Disable ext4 support, because it is experimental and not support with standard kernel and tools.
Fix regex (because the '?' operator isn't supported).
Fix strptime in snapper/AppUtil.cc, because musl doesn't support '%F'.
Diffstat (limited to 'testing/snapper/regex.patch')
-rw-r--r-- | testing/snapper/regex.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/snapper/regex.patch b/testing/snapper/regex.patch new file mode 100644 index 00000000000..97dc7fa4af9 --- /dev/null +++ b/testing/snapper/regex.patch @@ -0,0 +1,50 @@ +--- a/snapper/AsciiFile.cc.orig ++++ b/snapper/AsciiFile.cc +@@ -211,7 +211,7 @@ + + string line = key + "=\"" + value + "\""; + +- Regex rx('^' + Regex::ws + key + '=' + "(['\"]?)([^'\"]*)\\1" + Regex::ws + '$'); ++ Regex rx('^' + Regex::ws + key + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$'); + + vector<string>::iterator it = find_if(lines(), regex_matches(rx)); + if (it == lines().end()) +@@ -226,12 +226,15 @@ + bool + SysconfigFile::getValue(const string& key, string& value) const + { +- Regex rx('^' + Regex::ws + key + '=' + "(['\"]?)([^'\"]*)\\1" + Regex::ws + '$'); ++ Regex rx('^' + Regex::ws + key + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$'); + + if (find_if(lines(), regex_matches(rx)) == lines().end()) + return false; + +- value = rx.cap(2); ++ value = rx.cap(1); ++ if (!value.empty() && (value.front() == '"' || value.front() == '\'')) { ++ value = std::string(value.begin() + 1, value.end() - 1); ++ } + y2mil("key:" << key << " value:" << value); + return true; + } +@@ -295,12 +298,18 @@ + { + map<string, string> ret; + +- Regex rx('^' + Regex::ws + "([0-9A-Z_]+)" + '=' + "(['\"]?)([^'\"]*)\\2" + Regex::ws + '$'); ++ Regex rx('^' + Regex::ws + "([0-9A-Z_]+)" + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$'); + + for (vector<string>::const_iterator it = Lines_C.begin(); it != Lines_C.end(); ++it) + { + if (rx.match(*it)) +- ret[rx.cap(1)] = rx.cap(3); ++ { ++ string value = rx.cap(2); ++ if (!value.empty() && (value.front() == '"' || value.front() == '\'')) { ++ value = std::string(value.begin() + 1, value.end() - 1); ++ } ++ ret[rx.cap(1)] = value; ++ } + } + + return ret; |