I compiled mod_python with python3
In order to get python3 linked with mod_python.so, I applied changes present in pull reqest : #86
with python linked to mod_python.so I was able to run mod_python and python related APIs.
However parse_qsl function present in src/_apachemodule.c seems to fail for some key-value pairs(where key contains underscore).
Here is what I did:
I added pdb (python debugger) to lib/python/mod_python/util.py at line 251.
And I ran apache on foreground with debug option enabled using gdb
following is the command I used to run apache on foreground with debug mode
gdb --args /usr/sbin/apache2 -X -k start
when I hit the url, I entered pdb session where I called parse_qsl with various parameters
following is the console output.
> /usr/local/lib/python3.5/dist-packages/mod_python/util.py(254)__init__()
-> if req.args:
(Pdb) l
249
250 self.list = FieldList()
251
252 # always process GET-style parameters
253 pdb.set_trace()
254 -> if req.args:
255 pairs = parse_qsl(req.args, keep_blank_values)
256 for pair in pairs:
257 self.add_field(pair[0], pair[1])
258
(Pdb) parse_qsl("test_token=abcdefghij", 0)
[('test_token', 'abcdefghij')]
(Pdb) parse_qsl("Hakuna=Matata", 0)
[('Hakuna', 'Matata')]
(Pdb) parse_qsl("something_good=abcdefghij", 0)
Thread 3 "apache2" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe960d700 (LWP 58870)]
parse_qsl (self=<optimized out>, args=<optimized out>) at _apachemodule.c:380
380 _apachemodule.c: No such file or directory.
It seems like in src/_apachemodule.c
at line 376 and 377 we are decoding string to UTF8, if there is some error, it returns null which makes ukey or uval to be null and at line 379 and at line 380
we are running Py_DECREF which raises SIGSEGV segmentation fault when we pass null value in it
I compiled mod_python with python3
In order to get python3 linked with mod_python.so, I applied changes present in pull reqest : #86
with python linked to mod_python.so I was able to run mod_python and python related APIs.
However parse_qsl function present in
src/_apachemodule.cseems to fail for some key-value pairs(where key contains underscore).Here is what I did:
I added pdb (python debugger) to lib/python/mod_python/util.py at line 251.
And I ran apache on foreground with debug option enabled using gdb
following is the command I used to run apache on foreground with debug mode
gdb --args /usr/sbin/apache2 -X -k startwhen I hit the url, I entered pdb session where I called parse_qsl with various parameters
following is the console output.
It seems like in src/_apachemodule.c
at line 376 and 377 we are decoding string to UTF8, if there is some error, it returns null which makes ukey or uval to be null and at line 379 and at line 380
we are running Py_DECREF which raises SIGSEGV segmentation fault when we pass null value in it