Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
Hi Daniel, On 12/14/2012 12:46 PM, Daniel Gruno wrote: Bloody Windows ;) I know, but what can you do? :) I have added an #ifdef for the tms stuff, as I saw mod_status did the same. If there is another way of making it work, I will change it as soon as I find a proper way to deal with it. All these worked so at least it will compile now. I was pointed to this one by a Netware guy asking if I'm seeing it too, and I am; c:\build4\httpd-head-r1422296\modules\lua\lua_apr.c(430) : warning C4700: uninitialized local variable 'err' CC lua_apr.c ### mwccnlm Compiler: #File: lua_apr.c # -- # 412: const char *pattern, *source, *err; # Warning:^ # variable 'err' is not initialized before being used Two other things I noticed now that some of the noise has settled are; c:\build4\httpd-head-r1422296\modules\lua\lua_apr.c(1125) : warning C4716: 'ap_lua_load_httpd_functions' : must return a value c:\build4\httpd-head-r1422296\modules\lua\mod_lua.c(120) : warning C4715: 'scope_to_string' : not all control paths return a value On mod_lua.c look at your first two cases at lines 104 105, is that correct? Cheers, Gregg
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
Am 12.12.2012 22:44, schrieb Marion Christophe JAILLET: Here are a few things triggered by cppcheck. Le 11/12/2012 21:08, humbed...@apache.org a écrit : Author: humbedooh Date: Tue Dec 11 20:08:24 2012 New Revision: 1420377 URL: http://svn.apache.org/viewvc?rev=1420377view=rev Log: mod_lua: Add a lot of core httpd/apr functionality to mod_lua (such as regex matching, expr evaluation, changing/fetching server configuration/info - see docs for a complete list). This also includes a bunch of automatically scraped functions, which may or may not be super useful. Comments appreciated as always, especially on the more hacky bits. Modified: httpd/httpd/trunk/modules/lua/lua_apr.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1420377r1=1420376r2=1420377view=diff == --- httpd/httpd/trunk/modules/lua/lua_apr.c (original) +++ httpd/httpd/trunk/modules/lua/lua_apr.c Tue Dec 11 20:08:24 2012 I've put the parsed file on: http://people.apache.org/~jailletc36/lua_apr.html Check it from there. Things noticed by cppcheck are red-marked. Except the 'The scope of the variable '...' can be reduced' that can be ignored, all the other remarks are relevant. Especially: a useless apr_pcalloc (line 249) a out of bound access (line 321) -- I don't know if Rsha1 should be [20] or if the loop should be limited to 16 this seems to be a cut and paste error from lua_apr_md5 a uninitialized variable (line 430) beside these probs there are type mismatches which break strict compilers: AR obj_release/lua.lib CC mod_lua.c CC lua_apr.c ### mwccnlm Compiler: #File: lua_apr.c # -- # 278: apr_md5_final(digest.chr, md5); # Error:^ # illegal implicit conversion from 'char[16]' to # 'unsigned char *' # Too many errors printed, aborting program User break, cancelled... make[2]: *** [obj_release/lua_apr.o] Error 2 CC lua_config.c CC lua_request.c ### mwccnlm Compiler: #File: lua_request.c # -- # 230: if (lua_read_body(r, data, size) != OK) { # Error: ^ # illegal implicit conversion from 'unsigned int *' to # 'long long *' # Too many errors printed, aborting program User break, cancelled... make[2]: *** [obj_release/lua_request.o] Error 2 Daniel, please check the used types more carefully and either change them or cast. Gün.
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
On 12/14/2012 10:48 AM, Guenter Knauf wrote: Am 12.12.2012 22:44, schrieb Marion Christophe JAILLET: Here are a few things triggered by cppcheck. Le 11/12/2012 21:08, humbed...@apache.org a écrit : Author: humbedooh Date: Tue Dec 11 20:08:24 2012 New Revision: 1420377 URL: http://svn.apache.org/viewvc?rev=1420377view=rev Log: mod_lua: Add a lot of core httpd/apr functionality to mod_lua (such as regex matching, expr evaluation, changing/fetching server configuration/info - see docs for a complete list). This also includes a bunch of automatically scraped functions, which may or may not be super useful. Comments appreciated as always, especially on the more hacky bits. Modified: httpd/httpd/trunk/modules/lua/lua_apr.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1420377r1=1420376r2=1420377view=diff == --- httpd/httpd/trunk/modules/lua/lua_apr.c (original) +++ httpd/httpd/trunk/modules/lua/lua_apr.c Tue Dec 11 20:08:24 2012 I've put the parsed file on: http://people.apache.org/~jailletc36/lua_apr.html Check it from there. Things noticed by cppcheck are red-marked. Except the 'The scope of the variable '...' can be reduced' that can be ignored, all the other remarks are relevant. Especially: a useless apr_pcalloc (line 249) a out of bound access (line 321) -- I don't know if Rsha1 should be [20] or if the loop should be limited to 16 this seems to be a cut and paste error from lua_apr_md5 a uninitialized variable (line 430) beside these probs there are type mismatches which break strict compilers: AR obj_release/lua.lib CC mod_lua.c CC lua_apr.c ### mwccnlm Compiler: #File: lua_apr.c # -- # 278: apr_md5_final(digest.chr, md5); # Error:^ # illegal implicit conversion from 'char[16]' to # 'unsigned char *' # Too many errors printed, aborting program User break, cancelled... make[2]: *** [obj_release/lua_apr.o] Error 2 CC lua_config.c CC lua_request.c ### mwccnlm Compiler: #File: lua_request.c # -- # 230: if (lua_read_body(r, data, size) != OK) { # Error: ^ # illegal implicit conversion from 'unsigned int *' to # 'long long *' # Too many errors printed, aborting program User break, cancelled... make[2]: *** [obj_release/lua_request.o] Error 2 Daniel, please check the used types more carefully and either change them or cast. Gün. Thanks for the heads up, guys! I didn't receive Christophe's email, which is why I didn't put these fixes up till now. I will try to use that cppcheck program in the future, it seems very nice, and catches some things that my regular compiler warning settings don't. So thanks for that as well :) With regards, Daniel.
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
Hi Daniel, Am 14.12.2012 11:17, schrieb Daniel Gruno: Thanks for the heads up, guys! I didn't receive Christophe's email, which is why I didn't put these fixes up till now. I will try to use that cppcheck program in the future, it seems very nice, and catches some things that my regular compiler warning settings don't. So thanks for that as well :) you can also use maintainer mode when compiling which adds a bunch of gcc flags which might spot some more issues where a normal build doesnt even warn about. BTW. on topic there's another small issue which you introduced a while back (and it got even backported to 2.4.x already): http://svn.apache.org/viewvc?view=revisionrevision=1365539 it makes no sense to set this define in mod_lua.h - it is still required to build liblua 5.2 with the same define - otherwise you will get linkage errors: ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_apr.o ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_config.o ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_config.o ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_request.o ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_request.o ### mwldnlm Linker Error: # Undefined symbol: luaL_openlib in # lua_request.o so IMO the right solution would be to introduce a check for luaL_openlib in config.m4 and disable the module if not present, and if present then set the LUA_COMPAT_ALL via CFLAGS from config.m4 ... Gün.
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
On 12/14/2012 2:17 AM, Daniel Gruno wrote: On 12/14/2012 10:48 AM, Guenter Knauf wrote: Am 12.12.2012 22:44, schrieb Marion Christophe JAILLET: Here are a few things triggered by cppcheck. Le 11/12/2012 21:08, humbed...@apache.org a écrit : Author: humbedooh Date: Tue Dec 11 20:08:24 2012 New Revision: 1420377 URL: http://svn.apache.org/viewvc?rev=1420377view=rev Log: mod_lua: Add a lot of core httpd/apr functionality to mod_lua (such as regex matching, expr evaluation, changing/fetching server configuration/info - see docs for a complete list). This also includes a bunch of automatically scraped functions, which may or may not be super useful. Comments appreciated as always, especially on the more hacky bits. Modified: httpd/httpd/trunk/modules/lua/lua_apr.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1420377r1=1420376r2=1420377view=diff == --- httpd/httpd/trunk/modules/lua/lua_apr.c (original) +++ httpd/httpd/trunk/modules/lua/lua_apr.c Tue Dec 11 20:08:24 2012 Thanks for the heads up, guys! I didn't receive Christophe's email, which is why I didn't put these fixes up till now. I will try to use that cppcheck program in the future, it seems very nice, and catches some things that my regular compiler warning settings don't. So thanks for that as well :) Evidently an unused variable. .\lua_request.c(227) : warning C4101: 'z' : unreferenced local variable On the Windows side of things; lua_apr.c in use all over are uint32_t and we do not have uint32_t available. apr_uint32_t works well. Then there is; .\lua_apr.c(567) : error C2440: 'function' : cannot convert from 'apr_os_thread_t' to 'lua_Number' In scoreboard.h, tms is declared if HAVE_TIMES is defined. I assume that is sys/times.h which we do not seem to have. It seems there may be an APR alternative to this that I saw in modules\dav\fs\repos.c which may or may not be usable here or Windows will just have to go without these if possible. .\lua_apr.c(575) : error C2039: 'times' : is not a member of 'worker_score' c:\build4\httpd-head-r1421953\include\scoreboard.h(90) : see declaration of 'worker_score' .\lua_apr.c(579) : error C2039: 'times' : is not a member of 'worker_score' c:\build4\httpd-head-r1421953\include\scoreboard.h(90) : see declaration of 'worker_score' Regards, Gregg
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
On 12/14/2012 09:34 PM, Gregg Smith wrote: Evidently an unused variable. .\lua_request.c(227) : warning C4101: 'z' : unreferenced local variable On the Windows side of things; lua_apr.c in use all over are uint32_t and we do not have uint32_t available. apr_uint32_t works well. Then there is; .\lua_apr.c(567) : error C2440: 'function' : cannot convert from 'apr_os_thread_t' to 'lua_Number' In scoreboard.h, tms is declared if HAVE_TIMES is defined. I assume that is sys/times.h which we do not seem to have. It seems there may be an APR alternative to this that I saw in modules\dav\fs\repos.c which may or may not be usable here or Windows will just have to go without these if possible. .\lua_apr.c(575) : error C2039: 'times' : is not a member of 'worker_score' c:\build4\httpd-head-r1421953\include\scoreboard.h(90) : see declaration of 'worker_score' .\lua_apr.c(579) : error C2039: 'times' : is not a member of 'worker_score' c:\build4\httpd-head-r1421953\include\scoreboard.h(90) : see declaration of 'worker_score' Regards, Gregg Bloody Windows ;) But thanks a ton for your help, Gregg :) I have added an #ifdef for the tms stuff, as I saw mod_status did the same. If there is another way of making it work, I will change it as soon as I find a proper way to deal with it. With regards, Daniel.
Re: svn commit: r1420377 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml modules/lua/lua_apr.c modules/lua/lua_apr.h modules/lua/mod_lua.c
Here are a few things triggered by cppcheck. Le 11/12/2012 21:08, humbed...@apache.org a écrit : Author: humbedooh Date: Tue Dec 11 20:08:24 2012 New Revision: 1420377 URL: http://svn.apache.org/viewvc?rev=1420377view=rev Log: mod_lua: Add a lot of core httpd/apr functionality to mod_lua (such as regex matching, expr evaluation, changing/fetching server configuration/info - see docs for a complete list). This also includes a bunch of automatically scraped functions, which may or may not be super useful. Comments appreciated as always, especially on the more hacky bits. Modified: httpd/httpd/trunk/modules/lua/lua_apr.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1420377r1=1420376r2=1420377view=diff == --- httpd/httpd/trunk/modules/lua/lua_apr.c (original) +++ httpd/httpd/trunk/modules/lua/lua_apr.c Tue Dec 11 20:08:24 2012 I've put the parsed file on: http://people.apache.org/~jailletc36/lua_apr.html Check it from there. Things noticed by cppcheck are red-marked. Except the 'The scope of the variable '...' can be reduced' that can be ignored, all the other remarks are relevant. Especially: a useless apr_pcalloc (line 249) a out of bound access (line 321) -- I don't know if Rsha1 should be [20] or if the loop should be limited to 16 this seems to be a cut and paste error from lua_apr_md5 a uninitialized variable (line 430) CJ