Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/liblognorm/files/, dev-libs/liblognorm/
Date: Fri, 09 Oct 2015 14:12:15
Message-Id: 1444399913.3027e7c1fcea0709ad9bebfbe14387ef52837c62.polynomial-c@gentoo
1 commit: 3027e7c1fcea0709ad9bebfbe14387ef52837c62
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 9 13:10:39 2015 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 9 14:11:53 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3027e7c1
7
8 dev-libs/liblognorm: Revbump to remove semi-broken pcre functionality
9
10 and add an upstream patch.
11
12 Package-Manager: portage-2.2.23
13 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
14
15 .../files/liblognorm-1.1.2-issue_135.patch | 110 +++++++++++++++++++++
16 dev-libs/liblognorm/liblognorm-1.1.2-r1.ebuild | 57 +++++++++++
17 2 files changed, 167 insertions(+)
18
19 diff --git a/dev-libs/liblognorm/files/liblognorm-1.1.2-issue_135.patch b/dev-libs/liblognorm/files/liblognorm-1.1.2-issue_135.patch
20 new file mode 100644
21 index 0000000..4b4a063
22 --- /dev/null
23 +++ b/dev-libs/liblognorm/files/liblognorm-1.1.2-issue_135.patch
24 @@ -0,0 +1,110 @@
25 +From 4b35ca1e6fff50f47eb5419b879b287f49dcf1d8 Mon Sep 17 00:00:00 2001
26 +From: Rainer Gerhards <rgerhards@×××××××.com>
27 +Date: Mon, 24 Aug 2015 09:05:52 +0200
28 +Subject: [PATCH] "fix": process last line if it misses the terminating LF
29 +
30 +This problem occurs with the very last line of a rulebase (at EOF).
31 +If it is not properly terminated (LF missing), it is silently ignored.
32 +Previous versions did obviously process lines in this case. While
33 +technically this is invalid input, we can't outrule that such rulebases
34 +exist. For example, they do in the rsyslog testbench, which made
35 +us aware of the problem (see https://github.com/rsyslog/rsyslog/issues/489 ).
36 +
37 +I think the proper way of addressing this is to process such lines without
38 +termination, as many other tools do as well.
39 +
40 +closes https://github.com/rsyslog/liblognorm/issues/135
41 +---
42 + src/samp.c | 5 ++++-
43 + tests/Makefile.am | 2 ++
44 + tests/field_mac48.sh | 1 -
45 + tests/missing_line_ending.rb | 1 +
46 + tests/missing_line_ending.sh | 25 +++++++++++++++++++++++++
47 + 5 files changed, 32 insertions(+), 2 deletions(-)
48 + create mode 100644 tests/missing_line_ending.rb
49 + create mode 100755 tests/missing_line_ending.sh
50 +
51 +diff --git a/src/samp.c b/src/samp.c
52 +index ef57047..0a9ae0a 100644
53 +--- a/src/samp.c
54 ++++ b/src/samp.c
55 +@@ -801,7 +801,10 @@ ln_sampRead(ln_ctx ctx, FILE *const __restrict__ repo, int *const __restrict__ i
56 + int c = fgetc(repo);
57 + if(c == EOF) {
58 + *isEof = 1;
59 +- goto done;
60 ++ if(i == 0)
61 ++ goto done;
62 ++ else
63 ++ done = 1; /* last line missing LF, still process it! */
64 + } else if(c == '\n') {
65 + ++linenbr;
66 + if(!inParser && i != 0)
67 +diff --git a/tests/Makefile.am b/tests/Makefile.am
68 +index a3a3842..cfcf010 100644
69 +--- a/tests/Makefile.am
70 ++++ b/tests/Makefile.am
71 +@@ -13,6 +13,7 @@ user_test_LDFLAGS = -no-install
72 + TESTS_SHELLSCRIPTS = \
73 + parser_whitespace.sh \
74 + parser_LF.sh \
75 ++ missing_line_ending.sh \
76 + field_hexnumber.sh \
77 + field_mac48.sh \
78 + field_name_value.sh \
79 +@@ -54,6 +55,7 @@ REGEXP_TESTS = \
80 + field_regex_while_regex_support_is_disabled.sh
81 +
82 + EXTRA_DIST = exec.sh \
83 ++ missing_line_ending.rb \
84 + $(TESTS_SHELLSCRIPTS) \
85 + $(REGEXP_TESTS) \
86 + $(json_eq_self_sources) \
87 +diff --git a/tests/field_mac48.sh b/tests/field_mac48.sh
88 +index bd2898e..0f17166 100755
89 +--- a/tests/field_mac48.sh
90 ++++ b/tests/field_mac48.sh
91 +@@ -21,4 +21,3 @@ assert_output_json_eq '{ "originalmsg": "f0:f6:1c:xf:cc:a2", "unparsed-data": "f
92 +
93 +
94 + cleanup_tmp_files
95 +-
96 +diff --git a/tests/missing_line_ending.rb b/tests/missing_line_ending.rb
97 +new file mode 100644
98 +index 0000000..b252483
99 +--- /dev/null
100 ++++ b/tests/missing_line_ending.rb
101 +@@ -0,0 +1 @@
102 ++rule=:%field:mac48%
103 +\ No newline at end of file
104 +diff --git a/tests/missing_line_ending.sh b/tests/missing_line_ending.sh
105 +new file mode 100755
106 +index 0000000..18f4d2c
107 +--- /dev/null
108 ++++ b/tests/missing_line_ending.sh
109 +@@ -0,0 +1,25 @@
110 ++# added 2015-05-05 by Rainer Gerhards
111 ++# This file is part of the liblognorm project, released under ASL 2.0
112 ++. $srcdir/exec.sh
113 ++
114 ++test_def $0 "dmac48 syntax"
115 ++# we need to use a canned file, as we cannot easily reproduce the
116 ++# malformed lines
117 ++cp missing_line_ending.rb $(rulebase_file_name)
118 ++
119 ++execute 'f0:f6:1c:5f:cc:a2'
120 ++assert_output_json_eq '{"field": "f0:f6:1c:5f:cc:a2"}'
121 ++
122 ++execute 'f0-f6-1c-5f-cc-a2'
123 ++assert_output_json_eq '{"field": "f0-f6-1c-5f-cc-a2"}'
124 ++
125 ++# things that need to NOT match
126 ++
127 ++execute 'f0-f6:1c:5f:cc-a2'
128 ++assert_output_json_eq '{ "originalmsg": "f0-f6:1c:5f:cc-a2", "unparsed-data": "f0-f6:1c:5f:cc-a2" }'
129 ++
130 ++execute 'f0:f6:1c:xf:cc:a2'
131 ++assert_output_json_eq '{ "originalmsg": "f0:f6:1c:xf:cc:a2", "unparsed-data": "f0:f6:1c:xf:cc:a2" }'
132 ++
133 ++
134 ++#cleanup_tmp_files
135
136 diff --git a/dev-libs/liblognorm/liblognorm-1.1.2-r1.ebuild b/dev-libs/liblognorm/liblognorm-1.1.2-r1.ebuild
137 new file mode 100644
138 index 0000000..066a0c4
139 --- /dev/null
140 +++ b/dev-libs/liblognorm/liblognorm-1.1.2-r1.ebuild
141 @@ -0,0 +1,57 @@
142 +# Copyright 1999-2015 Gentoo Foundation
143 +# Distributed under the terms of the GNU General Public License v2
144 +# $Id$
145 +
146 +EAPI=5
147 +
148 +AUTOTOOLS_IN_SOURCE_BUILD=1
149 +AUTOTOOLS_AUTORECONF="yes"
150 +
151 +inherit autotools-utils
152 +
153 +DESCRIPTION="Fast samples-based log normalization library"
154 +HOMEPAGE="http://www.liblognorm.com"
155 +SRC_URI="http://www.liblognorm.com/files/download/${P}.tar.gz"
156 +
157 +LICENSE="LGPL-2.1"
158 +SLOT="0/2"
159 +KEYWORDS="~amd64 ~arm ~hppa ~x86 ~amd64-linux"
160 +IUSE="debug doc static-libs test"
161 +
162 +RDEPEND="
163 + >=dev-libs/libestr-0.1.3
164 + >=dev-libs/json-c-0.11:=
165 +"
166 +
167 +DEPEND="
168 + ${RDEPEND}
169 + virtual/pkgconfig
170 + doc? ( >=dev-python/sphinx-1.2.2 )
171 +"
172 +
173 +DOCS=( ChangeLog )
174 +
175 +PATCHES=(
176 + "${FILESDIR}"/respect_CFLAGS.patch
177 + "${FILESDIR}"/${PN}-1.1.2-issue_135.patch
178 +)
179 +
180 +src_configure() {
181 + local myeconfargs=(
182 + $(use_enable doc docs)
183 + $(use_enable test testbench)
184 + $(use_enable debug)
185 + --disable-regexp
186 + )
187 +
188 + autotools-utils_src_configure
189 +}
190 +
191 +src_test() {
192 + # When adding new tests via patches we have to make them executable
193 + einfo "Adjusting permissions of test scripts ..."
194 + find "${S}"/tests -type f -name '*.sh' \! -perm -111 -exec chmod a+x '{}' \; || \
195 + die "Failed to adjust test scripts permission"
196 +
197 + emake --jobs 1 check
198 +}