**missing braces around initializer** *mohq_funcs.c:2163* ``` LD (gcc) [M matrix.so] matrix.so CC (gcc) [M mohqueue.so] mohq_locks.o CC (gcc) [M mohqueue.so] mohq_funcs.o mohq_funcs.c: In function 'send_rtp_answer': mohq_funcs.c:2163:23: warning: missing braces around initializer [-Wmissing-braces] 2163 | fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0}; | ^ | { mohq_funcs.c:2163:23: warning: missing braces around initializer [-Wmissing-braces] 2163 | fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0}; | ^ | { } CC (gcc) [M mohqueue.so] mohq_db.o CC (gcc) [M mohqueue.so] mohqueue_mod.o make[3]: 'libsrdb1.so.1.0' is up to date. LD (gcc) [M mohqueue.so] mohqueue.so CC (gcc) [M msilo.so] msfuncs.o CC (gcc) [M msilo.so] msilo.o ``` **"_POSIX_C_SOURCE" redefined** ``` CC (gcc) [M app_python.so] python_iface.o CC (gcc) [M app_python.so] apy_kemi_export.o In file included from /usr/include/python2.7/pyconfig.h:6, from /usr/include/python2.7/Python.h:8, from apy_kemi_export.c:30: /usr/include/python2.7/pyconfig-64.h:1232: warning: "_POSIX_C_SOURCE" redefined 1232 | #define _POSIX_C_SOURCE 200112L | In file included from /usr/include/bits/libc-header-start.h:33, from /usr/include/stdio.h:27, from apy_kemi_export.c:26: /usr/include/features.h:265: note: this is the location of the previous definition 265 | # define _POSIX_C_SOURCE 200809L | CC (gcc) [M app_python.so] mod_Core.o CC (gcc) [M app_python.so] apy_kemi.o In file included from /usr/include/python2.7/pyconfig.h:6, from /usr/include/python2.7/Python.h:8, from apy_kemi.c:25: /usr/include/python2.7/pyconfig-64.h:1232: warning: "_POSIX_C_SOURCE" redefined 1232 | #define _POSIX_C_SOURCE 200112L | In file included from /usr/include/bits/libc-header-start.h:33, from /usr/include/stdio.h:27, from apy_kemi.c:21: /usr/include/features.h:265: note: this is the location of the previous definition 265 | # define _POSIX_C_SOURCE 200809L | CC (gcc) [M app_python.so] python_msgobj.o CC (gcc) [M app_python.so] mod_Router.o CC (gcc) [M app_python.so] app_python_mod. ```
The one for mohqueue was also reported on sr-dev by Henning, iirc.
The one for app_python seems not to be related to the code of kamailio, but something in the headers included from/by python devel library. There is no `_POSIX_C_SOURCE` in kamailio code for app_python, therefore is not something that can be fixed here, I guess. Maybe updates of those packages will fix it. On the other hand, python 2 is no longer maintained, our module will stay there till old OSes that ship it are still maintained, but I won't invest any effort in developing that module further, python3 should be everywhere these days.
I will remove `python` module and lease only `python3` module.
The problem is that in old distros that still have python2, even python3 is present, some of the python libraries are still only for python2. So removing might not be advisable for those distros, in other words, I would remove packaging app_python for those distros where python2 is no longer present.
If other modules use python2 they not affected. I will remove only python Kamailio module packaging that not more supported. Now affected only CenOS 6.
CentOS 7 and CenOS 8 not affected because they have python3 Kamailio modules.
The point was not about about kamailio modules, but about running a Python script via app_python, which needs to import an external Python library that is not available (upgraded) in Python3 in that distro.
So let's say, only for the sake of example, that I want to use SQLAlchemy in a python script to be run by kamailio via app_python/3, it has to be sure that SQLAlchemy is available for Python3 in that OS version, otherwise I cannot use app_python3.
Ok, Kamailio python modules will lease as it now without any changes.
The compiler complains about mohqueue braces but works fine as is. I couldn't find any way to silence the warning which makes no apparent difference.
could you check this https://stackoverflow.com/questions/14670864/gcc-member-initialization-in-ar... Maybe ```diff sdp_session_cell_t *psession; char pflagbuf [5]; strcpy (pflagbuf, "z20"); -fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0}; +fparam_t pzflag [1] = { + {"", FPARAM_STRING, {pflagbuf}, 0} +}; for (nsession = 0; (psession = get_sdp_session (pmsg, nsession)); nsession++) { int nstream; ```
Also `fparam_t pzflag [1]` mean array of one element. Why not used? ``` fparam_t pzflag = {"", FPARAM_STRING, {pflagbuf}, 0}; ``` Just a question.
Also this looks as memory access outside of `pzflag->v.asciiz` array boundaries. [Link](https://github.com/kamailio/kamailio/blob/2df6f9d6cb74bc115206e8b200af723426...)
pzflag->v.asciiz [pstream->ptime.len + 1] = 0;
@sergey-safarov - you can push the change you listed in a comment above:
``` -fparam_t pzflag [1] = {"", FPARAM_STRING, {pflagbuf}, 0}; +fparam_t pzflag [1] = { + {"", FPARAM_STRING, {pflagbuf}, 0} +}; ```
pushed c7781edcb37a35193ccdb9414183919aaa614d3a
Regarding the comment about out of bounds in `pzflag->v.asciiz [pstream->ptime.len + 1] = 0;`, a few lines above is a check not to have the len > 3, with the buffer being of size 5.
Closing this one.
Closed #2710.