httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: [kfogel@galois.collab.net: request for APR maintainer(s)]
Date Fri, 06 Oct 2000 22:23:31 GMT

At one time, this was requested, so that we could re-use file pointers I
believe.  I don't really remember, but it is a bogus thing.  I say remove
the check for NULL everyplace in APR.

We ALWAYS want APR to be the allocator for any incomplete structure.

Good catch.

Ryan

On Fri, 6 Oct 2000, Greg Stein wrote:

> What is the rationale for a non-NULL pointer to apr_open()? Do we really
> need to be able to supply storage?
> 
> It has bit us in Apache itself, and several times in SVN. I'd like to change
> it, but was unsure whether there was a reason for this behavior.
> 
> [ checking Apache... ]
> 
> I've looked through all the calls that Apache makes to apr_open. The
> results:
> 
> *) most initialize the value to NULL first, then call apr_open(). there are
>    two or three places in lib/apr/test/*.c that call apr_open() once, then
>    do it again later without resetting to NULL. I'm presuming this is a bug
>    rather than purposeful behavior. (semantic bug: it works but was probably
>    not what the programmer intended)
> 
> *) threadproc/os2/proc.c calls apr_open() without initializing the value to
>    NULL first. this isn't a problem because file_io/os2/open.c does NOT
>    check for a non-NULL value.
> 
> *) support/htdigest.c has a bug with a call where it doesn't init to NULL
> 
> *) main/http_log.c has a suspicious call
> 
> I would like to change apr_open() to always return new storage. Any
> objections?
> 
> Cheers,
> -g
> 
> ----- Forwarded message from Karl Fogel <kfogel@galois.collab.net> -----
> 
> Date: Fri, 6 Oct 2000 15:48:10 -0500
> From: Karl Fogel <kfogel@galois.collab.net>
> To: dev@subversion.tigris.org
> Subject: request for APR maintainer(s)
> Reply-To: kfogel@collab.net
> 
> Greg (S), this one's for you, if you agree:
> 
> The requirement to initialize file handles to NULL before passing them
> to apr_open() just bit me again, for probably the twentieth time.  I
> spent an hour debugging it, because it manifested as a trashing of
> saved registers, one of which happened to contain the return addr for
> main().  This was a bit frustrating. :-)
> 
> When this topic came up on here once before, you mentioned that a few
> other APR maintainers felt the same way, and that there was a
> possibility the interface to apr_open() would be changed.
> 
> Is this still possible?  I have a feeling this is going to keep
> hitting us over and over, and I doubt (?) anyone out there really
> depends on being able to pass non-null handles in.
> 
> -K
> 
> Enjoy this excerpt from my GDB session over the phone with JimB
> helping:
> >...
> 
> (gdb) break main.c:main
> Breakpoint 1 at 0x80499b6: file main.c, line 199.
> Breakpoint 2 at 0x8049b06: file main.c, line 234.
> (gdb) run checkout --xml-file ../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file
../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Linux thread target has modified Unknown signal handling
> 
> Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
> (gdb) info frame
> Stack level 0, frame at 0xbffff8ec:
>  eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
>  called by frame at 0xbffff928
>  source language c.
>  Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
>  Locals at 0xbffff8ec, Previous frame's sp is 0x0
>  Saved registers:
>   ebp at 0xbffff8ec, eip at 0xbffff8f0
> (gdb) c
> Continuing.
> Breakpoint 2, main (argc=134748700, argv=0x0) at main.c:234
> (gdb) info frame
> Stack level 0, frame at 0xbffff8ec:
>  eip = 0x8049b06 in main (main.c:234); saved eip 0xffffffff
>  called by frame at 0x808195c
>  source language c.
>  Arglist at 0xbffff8ec, args: argc=134748700, argv=0x0
>  Locals at 0xbffff8ec, Previous frame's sp is 0x0
>  Saved registers:
>   ebp at 0xbffff8ec, eip at 0xbffff8f0
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Linux thread target has restored Unknown signal handling
> Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file
../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Linux thread target has modified Unknown signal handling
> Linux thread target has modified Unknown signal handling
> 
> Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
> (gdb) info frame
> Stack level 0, frame at 0xbffff8ec:
>  eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
>  called by frame at 0xbffff928
>  source language c.
>  Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
>  Locals at 0xbffff8ec, Previous frame's sp is 0x0
>  Saved registers:
>   ebp at 0xbffff8ec, eip at 0xbffff8f0
> (gdb) display/a *(long *)0xbffff8f0
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
>     at checkout.c:130
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x5
> (gdb) n
> *** output flushed ***
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Linux thread target has restored Unknown signal handling
> Linux thread target has restored Unknown signal handling
> Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file
../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Linux thread target has modified Unknown signal handling
> Linux thread target has modified Unknown signal handling
> 
> Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
>     at checkout.c:130
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 1: /a *(long *) 3221223664 = 0x5
> (gdb) p apr_err
> $1 = 0
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Linux thread target has restored Unknown signal handling
> Linux thread target has restored Unknown signal handling
> Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file
../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Linux thread target has modified Unknown signal handling
> Linux thread target has modified Unknown signal handling
> 
> Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) info frame
> Stack level 0, frame at 0xbffff8ec:
>  eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
>  called by frame at 0xbffff928
>  source language c.
>  Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
>  Locals at 0xbffff8ec, Previous frame's sp is 0x0
>  Saved registers:
>   ebp at 0xbffff8ec, eip at 
> (gdb) display/a *(long *)0xbffff8f0
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
>     at checkout.c:130
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> apr_open (new=0xbffff8b0, 
>     fname=0x80819cc "../libsvn_wc/tests/checkout-1.delta", flag=5, perm=4095, 
>     cont=0x808195c) at open.c:83
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 2: /a *(long *) 3221223664 = 0xffffffff
> 1: /a *(long *) 3221223664 = 0xffffffff
> (gdb) run
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Linux thread target has restored Unknown signal handling
> Linux thread target has restored Unknown signal handling
> Starting program: /home/kfogel/src/subversion/subversion/client/svn checkout --xml-file
../libsvn_wc/tests/checkout-1.delta --target-dir this/is/a/test/dir
> Linux thread target has modified Unknown signal handling
> Linux thread target has modified Unknown signal handling
> 
> Breakpoint 1, main (argc=6, argv=0xbffff954) at main.c:199
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) info frame
> Stack level 0, frame at 0xbffff8ec:
>  eip = 0x80499b6 in main (main.c:199); saved eip 0x40044a42
>  called by frame at 0xbffff928
>  source language c.
>  Arglist at 0xbffff8ec, args: argc=6, argv=0xbffff954
>  Locals at 0xbffff8ec, Previous frame's sp is 0x0
>  Saved registers:
>   ebp at 0xbffff8ec, eip at 0xbffff8f0
> (gdb) display/a *(long *)0xbffff8f0
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> svn_client_checkout (path=0x80819f4, xml_src=0x80819bc, pool=0x808195c)
>     at checkout.c:130
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) s
> apr_open (new=0xbffff8b0, 
>     fname=0x80819cc "../libsvn_wc/tests/checkout-1.delta", flag=5, perm=4095, 
>     cont=0x808195c) at open.c:83
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) n
> 3: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 2: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> 1: /a *(long *) 3221223664 = 0x40044a42 <__libc_start_main+274>
> (gdb) The program is running.  Exit anyway? (y or n) y
> Linux thread target has restored Unknown signal handling
> Linux thread target has restored Unknown signal handling
> 
> Debugger finished
> 
> ----- End forwarded message -----
> 
> -- 
> Greg Stein, http://www.lyra.org/
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message