View Issue Details

IDProjectCategoryView StatusLast Update
0006185Talerexchangepublic2020-04-16 21:50
Reporterfefe Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Version0.7.0 
Target Version0.7.1Fixed in Version0.7.1 
Summary0006185: confusing assertion before code handling the cases that trigger the assert
DescriptionThis is in run_reserve_closures in exchange/src/exchange/taler-exchange-closer.c:

445 qs = db_plugin->get_expired_reserves (db_plugin->cls,
446 session,
447 now,
448 &expired_reserve_cb,
449 &erc);
450 GNUNET_assert (1 >= qs);
451 switch (qs)
452 {
453 case GNUNET_DB_STATUS_HARD_ERROR:

460 case GNUNET_DB_STATUS_SOFT_ERROR:

467 case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:

484 case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:

These values are defined in gnunet_db_lib.h:

 39 GNUNET_DB_STATUS_HARD_ERROR = -2,
 45 GNUNET_DB_STATUS_SOFT_ERROR = -1,
 53 GNUNET_DB_STATUS_SUCCESS_NO_RESULTS = 0,
 58 GNUNET_DB_STATUS_SUCCESS_ONE_RESULT = 1

so the only case the assertion on line 450 lets through is GNUNET_DB_STATUS_SUCCESS_ONE_RESULT.
TagsNo tags attached.

Activities

Christian Grothoff

2020-04-15 16:02

manager   ~0015656

I think you're reading the assertion wrong. 1 >= qs excludes qs values of 2, 3, 4, etc.

qs > 1 is a valid result for SQL statements that had more than one result (and no LIMIT 1 clause). That's what the assertion checks against.

Christian Grothoff

2020-04-16 21:45

manager   ~0015668

fefe: all good on this one?

fefe

2020-04-16 21:48

developer   ~0015669

Yes, sorry. That was a brain fart. :-)

Christian Grothoff

2020-04-16 21:49

manager   ~0015670

No problem, better a false-positive than a false-negative ;-).

Issue History

Date Modified Username Field Change
2020-04-15 15:53 fefe New Issue
2020-04-15 15:53 fefe Status new => assigned
2020-04-15 15:53 fefe Assigned To => Christian Grothoff
2020-04-15 16:02 Christian Grothoff Note Added: 0015656
2020-04-15 20:54 Christian Grothoff Status assigned => feedback
2020-04-16 21:45 Christian Grothoff Note Added: 0015668
2020-04-16 21:48 fefe Note Added: 0015669
2020-04-16 21:48 fefe Status feedback => assigned
2020-04-16 21:49 Christian Grothoff Note Added: 0015670
2020-04-16 21:50 Christian Grothoff Status assigned => resolved
2020-04-16 21:50 Christian Grothoff Resolution open => no change required
2020-04-16 21:50 Christian Grothoff Fixed in Version => 0.7.1
2020-04-16 21:50 Christian Grothoff Status resolved => closed
2020-04-16 21:50 Christian Grothoff Target Version => 0.7.1