Message ID | 20161202012934.GB2244@my.box |
---|---|
State | New |
Headers | show |
On Fri, Dec 02, 2016 at 02:29:34AM +0100, Neels Hofmeyr wrote: > Heads up, the current openbsc build is broken, as verified by > https://jenkins.osmocom.org/jenkins/job/OpenBSC/ > > This is due to below libosmocore commit, which adds two items to enum > chreq_type, thereby implicitly enlarging the ctype_by_chreq struct and breaking > the static assert for gsm_network->ctype_by_chreq's size: > > ../../../src/libbsc/gsm_04_08_utils.c:138:1: error: size of array ‘dummyassert_size’ is negative > osmo_static_assert(sizeof(ctype_by_chreq) == > ^ > > What this patch lacks is > > * adjustment of ctype_by_chreq[] according to the new additions in > libbsc/gsm_04_08_utils.c > * same for reason_by_chreq[], also in libbsc/gsm_04_08_utils.c > * enlarge ctype_by_chreq[] in gsm_network to 18, in openbsc/gsm_data.h. there are related changes in not-yet-pushed commits in openbsc.git, which should be pushed by the team working on this. It's really sad that we have such a chicken-and-egg situation now, where we will introduce a backward-incompatibility, i.e. a newer libosmocore will be source-code incompatible with older openbsc. This is really sad and we should avoid such situations if possible at all. From that point of view, the static_assert is highly questionable in openbsc.git, because it assumes that an enum is never getting extended in the library :( But of course we cannot change past versions of openbsc.git. But please let's all try to remember this issue and not create one again.
> From that point of view, the static_assert is highly questionable in > openbsc.git I'm glad that we have the assert, otherwise we would be writing past the array's end without noticing now... IMHO the way to update the enum is to have all patches on gerrit and collect +2 on them. Once the libosmocore part is merged, the openbsc one shall follow as soon as possible, unfortunately having to wait for the V+1 first. We could fix one part of this in general with a kind of LAST_ENTRY enum val in the sense of enum vals { VAL1, VAL2, LAST }; struct s { int arr[LAST]; }; (where 's' stands for gsm_network) Then the gsm_network struct size would of course change implicitly, depending on the .h file from libosmocore. But then it's still not possible to use the newly added enum values in the openbsc.git (to extend those other const arrays), so a two-part commit is still needed for this particular patch. --> move the const arrays to libosmocore? What did you have in mind? ~N
On Fri, Dec 02, 2016 at 01:43:40PM +0100, Neels Hofmeyr wrote: > > From that point of view, the static_assert is highly questionable in > > openbsc.git > > I'm glad that we have the assert, otherwise we would be writing past the > array's end without noticing now... I would rather have code that doesn't have such assumptions in the firstp place, without relying on the fact that an enum of a library doesn't extend in the future. I see the assert more as a hack around code with broken assumption. > What did you have in mind? I don't have the time right now to study the particular code in question, sorry. It will hav to wait for another 10 or 20 other things on my ever growing stack of todo items :/
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 767aa3d..c05b62e 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -1456,6 +1456,8 @@ enum chreq_type { CHREQ_T_PAG_R_TCH_F, CHREQ_T_PAG_R_TCH_FH, CHREQ_T_LMU, + CHREQ_T_PDCH_ONE_PHASE, + CHREQ_T_PDCH_TWO_PHASE, CHREQ_T_RESERVED_SDCCH, CHREQ_T_RESERVED_IGNORE, };