Re: bug report...

From: Date: Mon, 19 Jul 1999 00:28:30 +0000
Subject: Re: bug report...
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-8700@lists.php.net to get a copy of this message
On Mon, 19 Jul 1999, Zeev Suraski wrote: > The problem Sascha was (is) experiencing with source highlight seems to be > related, if not identical. There, it seems that for some reason, a FILE * > pointer that was obtained with fdopen(), was causing a crash when closed > with fclose(). I traced it with a debugger, and saw that instead of > fclose(), a function called _IO_old_fclose() was being called (the code > said fclose()). I tried checking whether fclose() and _IO_old_fclose() > have the same addresses - they don't, they're two separate functions. > I tried calling fclose() directly in the debugger - that seemed to call the > real fclose() (and not _IO_old_fclose()) - which worked flawlessly. I > checked it further - there seems to be an entire family of _IO_old_*() > functions; My guess is that if the FILE * was obtained using > _IO_old_fdopen() (which exists, but doesn't get called; the real fdopen() > does), _IO_old_fclose() would have worked on it. Somehow, some of the code > gets to use the standard functions, and the other gets to use the > _IO_old_*() functions. > The big question is where are these _IO_old_*() functions and _IO_new_*() > functions coming from, and why does it happen with APXS only. The _IO_old_*() and _IO_new_*() functions are a new feature of glibc 2.1, added so that the library can be completely backwards-compatible with glibc 2.0 despite incompatible changes to the code. I've run into the problem with fclose() in other places recently, and from what I can tell it's a problem with the way symbols are being resolved when a module is dlopen()ed. In /theory/, all symbols are supposed to default to the new version of the symbol, and normally this works correctly, but it looks like the libdl that ships with RH6.0 is improperly resolving some symbols to the old version. I've found that a generic workaround is to explicitly link against libc when compiling. This forces the symbol versions to be resolved at link time, bypassing the libdl bugginess. -Steve Langasek postmodern programmer

« previous php.dev (#8700) next »