Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build warnings #2710

Closed
sergey-safarov opened this issue Apr 16, 2021 · 13 comments
Closed

build warnings #2710

sergey-safarov opened this issue Apr 16, 2021 · 13 comments

Comments

@sergey-safarov
Copy link
Member

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.
@miconda
Copy link
Member

miconda commented Apr 16, 2021

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.

@sergey-safarov
Copy link
Member Author

sergey-safarov commented Apr 16, 2021

I will remove python module rpm packaging and leave only python3 module.

@miconda
Copy link
Member

miconda commented Apr 16, 2021

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.

@sergey-safarov
Copy link
Member Author

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.

@miconda
Copy link
Member

miconda commented Apr 16, 2021

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) to 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.

@sergey-safarov
Copy link
Member Author

sergey-safarov commented Apr 16, 2021

Ok, Kamailio python modules will leave as it now without any changes.

@rdboisvert
Copy link
Contributor

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.

@sergey-safarov
Copy link
Member Author

could you check this https://stackoverflow.com/questions/14670864/gcc-member-initialization-in-array-of-struct
Maybe

 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;

@sergey-safarov
Copy link
Member Author

Also fparam_t pzflag [1] mean array of one element.
Why not used?

fparam_t pzflag = {"", FPARAM_STRING, {pflagbuf}, 0};

Just a question.

@sergey-safarov
Copy link
Member Author

Also this looks as memory access outside of pzflag->v.asciiz array boundaries. Link

pzflag->v.asciiz [pstream->ptime.len + 1] = 0;

@miconda
Copy link
Member

miconda commented Apr 27, 2021

@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}
+};

@sergey-safarov
Copy link
Member Author

pushed c7781ed

@miconda
Copy link
Member

miconda commented Apr 27, 2021

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.

@miconda miconda closed this as completed Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants