This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-hlr/+/14364 )
Change subject: db_hlr: zero-initialize "struct tm"
......................................................................
db_hlr: zero-initialize "struct tm"
The last LU time gets read from the database as string, parsed with
strptime to "struct tm", and then gets converted to time_t with mktime.
A recent behavior change in glibc's mktime implementation unconvered,
that we don't have tm.tm_isdst (daylight saving time) set properly. As
"struct tm" was not initialized, and strptime did not write to tm_isdst,
it was set to a random value. When it was not 0, db_test failed on UTC
systems with a more recent glibc (e.g. Ubuntu 19.04).
Fix this by zero-initializing "struct tm" and remove the previous
workaround that made db_test pass on UTC systems.
Related: OS#4026
Change-Id: Iebbbe42fc5cd43324206d9433ede67b39251389c
---
M src/db_hlr.c
M tests/testsuite.at
2 files changed, 2 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 362dcf2..694ac53 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -445,7 +445,7 @@
int rc;
int ret = 0;
const char *last_lu_seen_str;
- struct tm tm;
+ struct tm tm = {0};
/* execute the statement */
rc = sqlite3_step(stmt);
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7d268d1..70ae7ae 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -29,12 +29,10 @@
AT_CHECK([$abs_top_builddir/tests/gsup_server/gsup_server_test], [], [expout], [experr])
AT_CLEANUP
-# TZ=CET: workaround for glibc bug in mktime() (https://osmocom.org/issues/4026):
-# "Cannot convert LU timestamp '2019-05-26 03:05:03' to time_t: Value too large for defined data type"
AT_SETUP([db])
AT_KEYWORDS([db])
cat $abs_srcdir/db/db_test.ok > expout
cat $abs_srcdir/db/db_test.err > experr
sqlite3 db_test.db < $abs_top_srcdir/sql/hlr.sql
-AT_CHECK([TZ=CET $abs_top_builddir/tests/db/db_test], [], [expout], [experr])
+AT_CHECK([$abs_top_builddir/tests/db/db_test], [], [expout], [experr])
AT_CLEANUP
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/14364
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Iebbbe42fc5cd43324206d9433ede67b39251389c
Gerrit-Change-Number: 14364
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling <stsp at stsp.name>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190604/97155e21/attachment.htm>