Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url()

2003-02-19 Thread Stas Bekman
Stas Bekman wrote:

Richard Clarke wrote:


Stas,



Doesn't seem like an apreq problem. It happens in the modperl function.



Any


chance you can rebuild mod_perl with debug mode enabled 
(PERL_DEBUG=1), so


we


can see the arguments and file/linenumbers? See:
http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option 





Program received signal SIGBUS, Bus error.
0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
1609url[x] = '\0';
(gdb) bt
#0  0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
#1  0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931


Richard, attached is the real fix, which will be committed shortly. The 
problem is in the way perl's default typemap translates undefs into char *. It 
wasn't allocating any strings. The following does the right thing. I've tested 
that undefs are now happily accepted and you get a proper warnings under -w.

Index: src/modules/perl/Apache.xs
===
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.125
diff -u -r1.125 Apache.xs
--- src/modules/perl/Apache.xs  6 Jul 2001 20:33:35 -   1.125
+++ src/modules/perl/Apache.xs  20 Feb 2003 05:11:36 -
@@ -655,8 +655,11 @@
 Apache r

 char *
-unescape_url(string)
-char *string
+unescape_url(sv)
+SV *sv
+
+INIT:
+char *string = SvPV_force(sv, PL_na);

 CODE:
 unescape_url(string);

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url ()

2003-02-18 Thread Richard Clarke
I'm using FreeBSD 4.7 Release. perl 5.6.1  Mod_Perl/Apache Latest 
libapreq 1.1.

Program received signal SIGBUS, Bus error.
0x80b2953 in ap_unescape_url ()
(gdb) bt
#0  0x80b2953 in ap_unescape_url ()
#1  0x8084094 in XS_Apache_unescape_url ()
#2  0x8102623 in Perl_pp_entersub ()
#3  0x80fcf4e in Perl_runops_standard ()
#4  0x80c0266 in perl_call_sv ()
#5  0x80c004a in perl_call_sv ()
#6  0x807c6ba in perl_call_handler ()
#7  0x807bfc0 in perl_run_stacked_handlers ()
#8  0x807b083 in perl_translate ()
#9  0x8098863 in ap_cleanup_method_ptrs ()
#10 0x80988ca in ap_translate_name ()
#11 0x80adf00 in ap_some_auth_required ()
#12 0x80ae47e in ap_process_request ()
#13 0x80a4db7 in ap_child_terminate ()
#14 0x80a4f79 in ap_child_terminate ()
#15 0x80a50f2 in ap_child_terminate ()
#16 0x80a5724 in ap_child_terminate ()
#17 0x80a5f84 in main ()
#18 0x8061f4d in _start ()
(gdb) quit

I'm performing unescape_uri() in a PerlTransHandler. This works perfectly
well on my Linux libapreq 1.0 box, so I'll try 1.0 instead.

I remember there was some discussion about 1.1 segv's when it was announced
but a quick search told me these were aimed at either 5.8 or file uploads.

Anyone got any suggestions whilst I go try libapreq 1.0

Richard.




Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url()

2003-02-18 Thread Stas Bekman
Richard Clarke wrote:

I'm using FreeBSD 4.7 Release. perl 5.6.1  Mod_Perl/Apache Latest 
libapreq 1.1.


Doesn't seem like an apreq problem. It happens in the modperl function. Any 
chance you can rebuild mod_perl with debug mode enabled (PERL_DEBUG=1), so we 
can see the arguments and file/linenumbers? See:
http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option

Program received signal SIGBUS, Bus error.
0x80b2953 in ap_unescape_url ()
(gdb) bt
#0  0x80b2953 in ap_unescape_url ()
#1  0x8084094 in XS_Apache_unescape_url ()
#2  0x8102623 in Perl_pp_entersub ()
#3  0x80fcf4e in Perl_runops_standard ()
#4  0x80c0266 in perl_call_sv ()
#5  0x80c004a in perl_call_sv ()
#6  0x807c6ba in perl_call_handler ()
#7  0x807bfc0 in perl_run_stacked_handlers ()
#8  0x807b083 in perl_translate ()
#9  0x8098863 in ap_cleanup_method_ptrs ()
#10 0x80988ca in ap_translate_name ()
#11 0x80adf00 in ap_some_auth_required ()
#12 0x80ae47e in ap_process_request ()
#13 0x80a4db7 in ap_child_terminate ()
#14 0x80a4f79 in ap_child_terminate ()
#15 0x80a50f2 in ap_child_terminate ()
#16 0x80a5724 in ap_child_terminate ()
#17 0x80a5f84 in main ()
#18 0x8061f4d in _start ()
(gdb) quit

I'm performing unescape_uri() in a PerlTransHandler. This works perfectly
well on my Linux libapreq 1.0 box, so I'll try 1.0 instead.

I remember there was some discussion about 1.1 segv's when it was announced
but a quick search told me these were aimed at either 5.8 or file uploads.

Anyone got any suggestions whilst I go try libapreq 1.0

Richard.



--


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url ()

2003-02-18 Thread Richard Clarke
Stas,

 Doesn't seem like an apreq problem. It happens in the modperl function.
Any
 chance you can rebuild mod_perl with debug mode enabled (PERL_DEBUG=1), so
we
 can see the arguments and file/linenumbers? See:
 http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option



Program received signal SIGBUS, Bus error.
0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
1609url[x] = '\0';
(gdb) bt
#0  0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
#1  0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931
#2  0x81040fb in Perl_pp_entersub ()
#3  0x80fea26 in Perl_runops_standard ()
#4  0x80c1d3e in S_call_body ()
#5  0x80c1b22 in perl_call_sv ()
#6  0x807d4de in perl_call_handler (sv=0x85cfb6c, r=0x8657034, args=0x0) at
mod_perl.c:1658
#7  0x807cc69 in perl_run_stacked_handlers (hook=0x8146daa
PerlTransHandler, r=0x8657034, handlers=0x85cfbe4)
at mod_perl.c:1371
#8  0x807b78f in perl_translate (r=0x8657034) at mod_perl.c:999
#9  0x809a403 in run_method (r=0x8657034, offset=0, run_all=0) at
http_config.c:370
#10 0x809a46a in ap_translate_name (r=0x8657034) at http_config.c:382
#11 0x80afa30 in process_request_internal (r=0x8657034) at
http_request.c:1199
#12 0x80affae in ap_process_request (r=0x8657034) at http_request.c:1324
#13 0x80a691f in child_main (child_num_arg=0) at http_main.c:4603
#14 0x80a6ae1 in make_child (s=0x817f034, slot=0, now=1045623388) at
http_main.c:4718
#15 0x80a6c5a in startup_children (number_to_start=50) at http_main.c:4800
#16 0x80a7288 in standalone_main (argc=2, argv=0xbfbffbb0) at
http_main.c:5108
#17 0x80a7ae8 in main (argc=2, argv=0xbfbffbb0) at http_main.c:5456
#18 0x8061f95 in _start ()

Its worth noting that the same function runs fine in a contenthandler, just
not in the transhandler.

Richard.




Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url()

2003-02-18 Thread Stas Bekman
Richard Clarke wrote:

Stas,



Doesn't seem like an apreq problem. It happens in the modperl function.


Any


chance you can rebuild mod_perl with debug mode enabled (PERL_DEBUG=1), so


we


can see the arguments and file/linenumbers? See:
http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option





Program received signal SIGBUS, Bus error.
0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
1609url[x] = '\0';
(gdb) bt
#0  0x80b445b in ap_unescape_url (url=0x8162e89 ) at util.c:1609
#1  0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931


much better ;)

[...]

Its worth noting that the same function runs fine in a contenthandler, just
not in the transhandler.


Since you don't show what the real code that fails, I can only offer to plug 
the hole in ap_unescape_url on the mod_perl side. I'll report the bug to the 
httpd-dev list.

Index: src/modules/perl/Apache.xs
===
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.125
diff -u -r1.125 Apache.xs
--- src/modules/perl/Apache.xs  6 Jul 2001 20:33:35 -   1.125
+++ src/modules/perl/Apache.xs  19 Feb 2003 05:04:04 -
@@ -659,7 +659,9 @@
 char *string

 CODE:
-unescape_url(string);
+/* ap_unescape_url segfaults when  is passed */
+if (string  string[0] != '\0')
+unescape_url(string);
 RETVAL = string;

 OUTPUT:


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com