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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/5297 sms.db: silence libdbi warnings on out-of-range index Apparently, since libdbi 0.9.0 aka 0.9.0-5 on debian-testing, osmo-msc barfs numerous libdbi warnings whenever a query rightfully returns no rows. Trivially query whether there are any rows first by adding an inline wrap function next_row(). Silenced: DDB <000d> ../../../../src/osmo-msc/src/libmsc/db.c:188 DBI: -6: An invalid or out-of-range index was passed to l DDB <000d> ../../../src/libosmocore/src/backtrace.c:47 backtrace() returned 11 addresses DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xfb81) [0x555555563b81] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/lib/x86_64-linux-gnu/libdbi.so.1(_error_handle DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/lib/x86_64-linux-gnu/libdbi.so.1(dbi_result_ne DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x11172) [0x555555565172] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1e6bc) [0x5555555726bc] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1e7f6) [0x5555555727f6] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0x1f1d2) [0x5555555731d2] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xbb86) [0x55555555fb86] DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0 DDB <000d> ../../../src/libosmocore/src/backtrace.c:57 /usr/local/bin/osmo-msc(+0xbfba) [0x55555555ffba] Related: OS#2737 OS#2667 Change-Id: I43cf4eed22425554826d59857eded5b4cc0d2c52 --- M openbsc/src/libmsc/db.c 1 file changed, 25 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/97/5297/1 diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 4ba12ca..15e7fd4 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -183,6 +183,13 @@ ")", }; +static inline int next_row(dbi_result result) +{ + if (!dbi_result_has_next_row(result)) + return 0; + return dbi_result_next_row(result); +} + void db_error_func(dbi_conn conn, void *data) { const char *msg; @@ -310,7 +317,7 @@ "Failed fetch messages from the old SMS table (upgrade from rev 3).\n"); goto rollback; } - while (dbi_result_next_row(result)) { + while (next_row(result)) { sms = sms_from_result_v3(result); if (db_sms_store(sms) != 0) { LOGP(DDB, LOGL_ERROR, "Failed to store message to the new SMS table(upgrade from rev 3).\n"); @@ -456,7 +463,7 @@ "Failed fetch messages from the old SMS table (upgrade from rev 4).\n"); goto rollback; } - while (dbi_result_next_row(result)) { + while (next_row(result)) { sms = sms_from_result_v4(result); if (db_sms_store(sms) != 0) { LOGP(DDB, LOGL_ERROR, "Failed to store message to the new SMS table(upgrade from rev 4).\n"); @@ -532,7 +539,7 @@ if (!result) return -EINVAL; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return -EINVAL; } @@ -726,7 +733,7 @@ if (!result) return -EIO; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return -ENOENT; } @@ -774,7 +781,7 @@ if (!result) return -EIO; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return -ENOENT; } @@ -860,7 +867,7 @@ if (!result) return -EIO; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return -ENOENT; } @@ -1050,7 +1057,7 @@ LOGP(DDB, LOGL_ERROR, "Failed to query Subscriber.\n"); return NULL; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { DEBUGP(DDB, "Failed to find the Subscriber. '%u' '%s'\n", field, id); dbi_result_free(result); @@ -1086,7 +1093,7 @@ LOGP(DDB, LOGL_ERROR, "Failed to query Subscriber: %llu\n", subscr->id); return -EIO; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { DEBUGP(DDB, "Failed to find the Subscriber. %llu\n", subscr->id); dbi_result_free(result); @@ -1279,7 +1286,7 @@ return -1; } - while (dbi_result_next_row(result)) { + while (next_row(result)) { struct gsm_subscriber *subscr; subscr = subscr_alloc(); @@ -1357,7 +1364,7 @@ return -EIO; } - while (dbi_result_next_row(result)) + while (next_row(result)) callback(priv, dbi_result_get_ulonglong(result, "id")); dbi_result_free(result); @@ -1396,7 +1403,7 @@ dbi_result_free(result); continue; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); DEBUGP(DDB, "Allocated TMSI %u for IMSI %s.\n", subscriber->tmsi, subscriber->imsi); @@ -1429,7 +1436,7 @@ dbi_result_free(result); continue; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); break; } @@ -1470,7 +1477,7 @@ dbi_result_free(result); continue; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); break; } @@ -1530,7 +1537,7 @@ LOGP(DDB, LOGL_ERROR, "Failed to query Equipment by IMEI.\n"); return 1; } - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { LOGP(DDB, LOGL_ERROR, "Failed to find the Equipment.\n"); dbi_result_free(result); return 1; @@ -1686,7 +1693,7 @@ if (!result) return NULL; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return NULL; } @@ -1715,7 +1722,7 @@ if (!result) return NULL; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return NULL; } @@ -1745,7 +1752,7 @@ if (!result) return NULL; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return NULL; } @@ -1774,7 +1781,7 @@ if (!result) return NULL; - if (!dbi_result_next_row(result)) { + if (!next_row(result)) { dbi_result_free(result); return NULL; } -- To view, visit https://gerrit.osmocom.org/5297 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I43cf4eed22425554826d59857eded5b4cc0d2c52 Gerrit-PatchSet: 1 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>