diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2019-01-29 18:44:34 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2019-01-29 18:45:21 +0100 |
commit | 7ead648e802fd4b503bf63bdea13f156b9babbee (patch) | |
tree | 810d74299e8cbb5a041b646aaf8235d790c2bc5e /main/liblognorm | |
parent | d37614ce585d5dcfa9ef4b641992dfc998b6574c (diff) | |
download | aports-7ead648e802fd4b503bf63bdea13f156b9babbee.tar.bz2 aports-7ead648e802fd4b503bf63bdea13f156b9babbee.tar.xz |
main/liblognorm: add patch for quoting support in parse-name-value
Diffstat (limited to 'main/liblognorm')
-rw-r--r-- | main/liblognorm/APKBUILD | 9 | ||||
-rw-r--r-- | main/liblognorm/parse-name-value-quoting-support.patch | 84 |
2 files changed, 90 insertions, 3 deletions
diff --git a/main/liblognorm/APKBUILD b/main/liblognorm/APKBUILD index 76107ca256..f336045720 100644 --- a/main/liblognorm/APKBUILD +++ b/main/liblognorm/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=liblognorm pkgver=2.0.6 -pkgrel=0 +pkgrel=1 pkgdesc="A fast log-normalization library" url="http://www.liblognorm.com" arch="all" @@ -11,7 +11,9 @@ depends_dev="libestr-dev" checkdepends="bash" makedepends="$depends_dev libfastjson-dev" subpackages="$pkgname-dev" -source="http://www.liblognorm.com/files/download/$pkgname-$pkgver.tar.gz" +source="http://www.liblognorm.com/files/download/$pkgname-$pkgver.tar.gz + parse-name-value-quoting-support.patch + " builddir="$srcdir/$pkgname-$pkgver" build() { @@ -35,4 +37,5 @@ package() { make DESTDIR="$pkgdir" install } -sha512sums="0b4ee55eb54920dd096fdd6d6dcc2263bc52e74442d86503bfebf26b31492a8c1b67cb3b709ecc8b96cc53252151515719027306b2b6f7ba3404adc5a48cf125 liblognorm-2.0.6.tar.gz" +sha512sums="0b4ee55eb54920dd096fdd6d6dcc2263bc52e74442d86503bfebf26b31492a8c1b67cb3b709ecc8b96cc53252151515719027306b2b6f7ba3404adc5a48cf125 liblognorm-2.0.6.tar.gz +0cebeda088e6e1c98aa370b7efbefde6d208540c7e02637940f87763535f8d6134a81a813640d7d4fa6f8ee0454e456ac9d133b4dced17f0ea8d0a3cb4c8542f parse-name-value-quoting-support.patch" diff --git a/main/liblognorm/parse-name-value-quoting-support.patch b/main/liblognorm/parse-name-value-quoting-support.patch new file mode 100644 index 0000000000..3541f8008f --- /dev/null +++ b/main/liblognorm/parse-name-value-quoting-support.patch @@ -0,0 +1,84 @@ +From 69392daac575cc29f9f3bf8f7369fae52f3fadf0 Mon Sep 17 00:00:00 2001 +From: Benoit DOLEZ <bdolez@pom-monitoring.com> +Date: Thu, 15 Dec 2016 00:16:27 +0100 +Subject: [PATCH] parseNameValue: fix no quoting support + +Function description announce support of quoted variable : +- name=value +- name="value" +- name='value' + +... but there is nothing in the code to really support quoted string. +I had small fixes to support it. + +My tests : +$ cat > test.txt <<EOF +a= +a=123 +a=123 +a='123' +a="123" +a=123 b=456 +a=123 b="456" +a=123 b="456" c= +a=123 b="456'789" c= +a=123 b="456 789" c= +a=123 b="456 789' c= +a=123 b=456 789 c= +EOF + +$ cat > test.rb << EOF +version=2 +rule=test-ok:%[ + {"type": "name-value-list"} + ]% +EOF + +$ cat test.txt | ./lognormalizer -r test.rb -T +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "event.tags": [ "test-ok" ] } +{ "originalmsg": "a=123 b=\"456 789' c= ", "unparsed-data": "a=123 b=\"456 789' c= " } +{ "originalmsg": "a=123 b=456 789 c= ", "unparsed-data": "a=123 b=456 789 c= " } +--- + src/parser.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +Patch-Source: https://github.com/rsyslog/liblognorm/pull/234 + +diff --git a/src/parser.c b/src/parser.c +index 7068362..74111f6 100644 +--- a/src/parser.c ++++ b/src/parser.c +@@ -1967,11 +1967,23 @@ parseNameValue(npb_t *const npb, + const size_t lenName = i - iName; + ++i; /* skip '=' */ + ++ char quoting = npb->str[i]; // end of string ++ if (i < npb->strLen && (quoting == '"' || quoting == '\'')) ++ ++i; ++ else ++ quoting = 0; // str[i] can't be null, is a good default value ++ + const size_t iVal = i; +- while(i < npb->strLen && !isspace(npb->str[i])) ++ while(i < npb->strLen && ++ ((quoting && npb->str[i] != quoting) || (!quoting && !isspace(npb->str[i])))) + ++i; + const size_t lenVal = i - iVal; + ++ if (i < npb->strLen && npb->str[i] == quoting) ++ ++i; ++ else if (quoting) ++ goto done; ++ + /* parsing OK */ + *offs = i; + r = 0; |