Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominika Liberda
aports
Commits
7ead648e
Commit
7ead648e
authored
6 years ago
by
Jakub Jirutka
Browse files
Options
Downloads
Patches
Plain Diff
main/liblognorm: add patch for quoting support in parse-name-value
parent
d37614ce
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/liblognorm/APKBUILD
+6
-3
6 additions, 3 deletions
main/liblognorm/APKBUILD
main/liblognorm/parse-name-value-quoting-support.patch
+84
-0
84 additions, 0 deletions
main/liblognorm/parse-name-value-quoting-support.patch
with
90 additions
and
3 deletions
main/liblognorm/APKBUILD
+
6
−
3
View file @
7ead648e
...
...
@@ -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"
This diff is collapsed.
Click to expand it.
main/liblognorm/parse-name-value-quoting-support.patch
0 → 100644
+
84
−
0
View file @
7ead648e
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;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment