From: Paul Gevers Date: Thu, 26 Sep 2024 16:57:23 +0000 (+0200) Subject: New upstream version 2.0.52 X-Git-Tag: archive/raspbian/2.0.52-1+rpi1^2~2^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ddb89a98ddd622579a8fe93071fb906562fb5bd4;p=siridb-server.git New upstream version 2.0.52 --- diff --git a/debian/changelog b/debian/changelog index fbb397e5..e1dc9dd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +siridb-server (2.0.52-0~cb1) unstable; urgency=medium + + * New upstream release + - Fixed potential bug with empty log log lines in series. + + -- Jeroen van der Heijden Mon, 23 Sep 2024 16:57:00 +0200 + siridb-server (2.0.50-0~cb1) unstable; urgency=medium * New upstream release diff --git a/grammar/grammar.py b/grammar/grammar.py index 8a7b4c5a..fa705c94 100644 --- a/grammar/grammar.py +++ b/grammar/grammar.py @@ -31,7 +31,7 @@ class SiriGrammar(Grammar): RE_KEYWORDS = re.compile('[a-z_]+') # Regular expressions - r_float = Regex('[-+]?[0-9]*\.?[0-9]+') + r_float = Regex(r'[-+]?[0-9]*\.?[0-9]+') r_integer = Regex('[-+]?[0-9]+') r_uinteger = Regex('[0-9]+') r_time_str = Regex('[0-9]+[smhdw]') @@ -39,7 +39,7 @@ class SiriGrammar(Grammar): r_doubleq_str = Regex('(?:"(?:[^"]*)")+') r_grave_str = Regex('(?:`(?:[^`]*)`)+') r_uuid_str = Regex( - '[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}') + r'[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}') # we only allow an optional 'i' for case-insensitive regex r_regex = Regex('(/[^/\\\\]*(?:\\\\.[^/\\\\]*)*/i?)') r_comment = Regex('#.*') diff --git a/include/siri/version.h b/include/siri/version.h index e0fcbe6b..07f5d401 100644 --- a/include/siri/version.h +++ b/include/siri/version.h @@ -6,7 +6,7 @@ #define SIRIDB_VERSION_MAJOR 2 #define SIRIDB_VERSION_MINOR 0 -#define SIRIDB_VERSION_PATCH 51 +#define SIRIDB_VERSION_PATCH 52 /* * Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions. diff --git a/itest/Dockerfile b/itest/Dockerfile index 688cfa02..c9ae8429 100644 --- a/itest/Dockerfile +++ b/itest/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 as builder +FROM ubuntu:18.04 AS builder RUN apt-get update && \ apt-get install -y \ libcleri-dev \ diff --git a/itest/querygenerator/k_map.py b/itest/querygenerator/k_map.py index df1ec550..ee89e9e7 100644 --- a/itest/querygenerator/k_map.py +++ b/itest/querygenerator/k_map.py @@ -94,4 +94,4 @@ k_map = { 'r_comment': { 'r_comment': '#', }, -} \ No newline at end of file +} diff --git a/itest/querygenerator/querygenerator.py b/itest/querygenerator/querygenerator.py index 4c53478f..68e83ace 100644 --- a/itest/querygenerator/querygenerator.py +++ b/itest/querygenerator/querygenerator.py @@ -58,9 +58,8 @@ class QueryGenerator(list): q[i] = val yield q break - + # debug code - # else: # print('no value found for:') # print(ename) @@ -71,7 +70,6 @@ class QueryGenerator(list): # print('unknown regex element') # print(ename) - def _on_Token(self, q, i): q[i] = q[i]._token yield q diff --git a/itest/run_all.py b/itest/run_all.py index 2574d600..c8eb599d 100644 --- a/itest/run_all.py +++ b/itest/run_all.py @@ -7,7 +7,7 @@ from test_buffer import TestBuffer from test_compression import TestCompression from test_create_database import TestCreateDatabase from test_expiration import TestExpiration -from test_grammar import TestGrammar +# from test_grammar import TestGrammar from test_group import TestGroup from test_http_api import TestHTTPAPI from test_insert import TestInsert @@ -31,7 +31,7 @@ if __name__ == '__main__': run_test(TestCompression()) run_test(TestCreateDatabase()) run_test(TestExpiration()) - run_test(TestGrammar()) + # run_test(TestGrammar()) run_test(TestGroup()) run_test(TestHTTPAPI()) run_test(TestInsert()) diff --git a/itest/test_integer_load.py b/itest/test_integer_load.py index acb0e4b5..6ce50856 100644 --- a/itest/test_integer_load.py +++ b/itest/test_integer_load.py @@ -38,14 +38,14 @@ class TestIntegerLoad(TestBase): async def select(self, client, series, n): series = {s.name: s for s in series} - chars=string.ascii_letters + string.digits + chars = string.ascii_letters + string.digits for _ in range(n): regex = ''.join(random.choice(chars) for _ in range(3)) - res = await client.query(f'select max() prefix "max-", min() prefix "min-", mean() prefix "mean-" from /.*{regex}.*/i') - if res: - print(res) - # for s, p in res.items(): - # self.assertEqual(sorted(series[s].points), p) + res = await client.query( + f'select max() prefix "max-", min() prefix "min-", ' + f'mean() prefix "mean-" from /.*{regex}.*/i') + for s, p in res.items(): + self.assertEqual(sorted(series[s].points), p) await asyncio.sleep(0.2) async def insert(self, client, series, n): diff --git a/itest/test_log.py b/itest/test_log.py index f293cf70..3808294e 100644 --- a/itest/test_log.py +++ b/itest/test_log.py @@ -21,6 +21,15 @@ from testing import parse_args DATA = { + 'empty': [ + [1471254710, ''], + [1471254712, ''], + [1471254714, ''], + [1471254715, ''], + [1471254716, ''], + [1471254718, ''], + [1471254720, ''] + ], 'log': [ [1471254710, 'log line one'], [1471254712, 'log line two'], @@ -234,6 +243,10 @@ class TestLog(TestBase): await self.test_data() async def test_data(self): + self.assertEqual( + await self.client0.query('select * from "empty"'), + {'empty': DATA['empty']}) + self.assertEqual( await self.client0.query('select * from "log"'), {'log': DATA['log']}) diff --git a/itest/test_parentheses.py b/itest/test_parentheses.py index 3d66657f..715c88a8 100644 --- a/itest/test_parentheses.py +++ b/itest/test_parentheses.py @@ -273,8 +273,8 @@ class TestParenth(TestBase): with self.assertRaisesRegex( QueryError, - 'Query error at position 29. Expecting \*, all, ' - 'single_quote_str, double_quote_str or \('): + r'Query error at position 29. Expecting \*, all, ' + r'single_quote_str, double_quote_str or \('): await self.client0.query( 'list series /.*/ - {}{}'.format('(' * 10, ')' * 10)) diff --git a/src/siri/db/points.c b/src/siri/db/points.c index e1004bbe..d0759f55 100644 --- a/src/siri/db/points.c +++ b/src/siri/db/points.c @@ -1118,7 +1118,6 @@ static int POINTS_unpack_string( { /* literal */ size_t len = (is_ascii) ? 0 : POINTS_dec_len(&pt); - do { *buf = *pt; @@ -1228,12 +1227,6 @@ int siridb_points_unzip_string( memcpy(&point->ts, pt, sizeof(uint64_t)); pt += sizeof(uint64_t); - buf = malloc(src_sz); - if (buf == NULL) - { - return -1; - } - for (mask = 0; tshift-- > tcount; ++pt) { mask |= ((uint64_t) *pt) << (tshift * 8); @@ -1265,6 +1258,12 @@ int siridb_points_unzip_string( n -= i; + buf = malloc(src_sz + n); + if (buf == NULL) + { + return -1; + } + if (POINTS_unpack_string( points->data + points->len, n, i, bits + offset, buf)) {