On Wed, 18 Sep 2002, Andreas Steinmetz wrote:
> Please CC me on replies as I'm not subscribed.
>
> libaspell-common-0.50.1.so closes stdin/stdout/stderr on library close
> which causes severe problems when dlopen()/dlclose() is used. In my case
> Apache-SSL aborts with an assertion as stderr is closed when
> /usr/lib/libpspell.so.15.0.1 is dlcose()d by php4 which implicitely
> closes libaspell-common-0.50.1.so which in turn closes stdin/stdout/stderr.
>
> System: Linux 2.4, gcc 3.2, binutils 2.13
The attached patch should fix the problem.
---
http://kevin.atkinson.dhs.org
? Makefile
? Makefile.in
? aclocal.m4
? autom4te.cache
? config.log
? config.status
? configure
? libtool
? stream.diff
? auto/Makefile
? auto/Makefile.in
? auto/auto
? auto/mk-src.pod
? auto/mk-src.txt
? common/.deps
? common/.libs
? common/Makefile
? common/Makefile.in
? common/can_have_error.lo
? common/config.lo
? common/convert.lo
? common/dirs.h
? common/document_checker.lo
? common/error.lo
? common/errors.cpp
? common/errors.hpp
? common/errors.lo
? common/file_util.lo
? common/filter.lo
? common/fstream.lo
? common/getdata.lo
? common/info.lo
? common/iostream.lo
? common/itemize.lo
? common/key_info.hpp
? common/libaspell-common.la
? common/mk-dirs_h
? common/posib_err.lo
? common/settings.h
? common/settings.h.in
? common/speller.lo
? common/stamp-h1
? common/string.lo
? common/string_buffer.lo
? common/string_list.lo
? common/string_map.lo
? common/string_pair.hpp
? common/string_pair_enumeration.hpp
? common/strtonum.lo
? common/tokenizer.lo
? common/type_id.hpp
? common/word_list.hpp
? data/Makefile
? data/Makefile.in
? examples/.deps
? examples/.libs
? examples/Makefile
? examples/Makefile.in
? examples/example-c
? examples/list-dicts
? interfaces/Makefile
? interfaces/Makefile.in
? interfaces/cc/Makefile
? interfaces/cc/Makefile.in
? interfaces/cc/aspell.h
? lib/.deps
? lib/.libs
? lib/Makefile
? lib/Makefile.in
? lib/can_have_error-c.cpp
? lib/can_have_error-c.lo
? lib/config-c.cpp
? lib/config-c.lo
? lib/document_checker-c.cpp
? lib/document_checker-c.lo
? lib/dummy.lo
? lib/error-c.cpp
? lib/error-c.lo
? lib/filter-c.cpp
? lib/filter-c.lo
? lib/find_speller.lo
? lib/info-c.cpp
? lib/info-c.lo
? lib/libaspell.la
? lib/libpspell.la
? lib/mutable_container-c.cpp
? lib/mutable_container-c.lo
? lib/new_checker.lo
? lib/new_config.lo
? lib/new_filter.lo
? lib/speller-c.cpp
? lib/speller-c.lo
? lib/string_enumeration-c.cpp
? lib/string_enumeration-c.lo
? lib/string_list-c.cpp
? lib/string_list-c.lo
? lib/string_map-c.cpp
? lib/string_map-c.lo
? lib/string_pair_enumeration-c.cpp
? lib/string_pair_enumeration-c.lo
? lib/word_list-c.cpp
? lib/word_list-c.lo
? manual/Makefile
? manual/Makefile.in
? manual/devel-html
? manual/devel-text
? manual/devel.aux
? manual/devel.dvi
? manual/devel.log
? manual/devel.tex
? manual/devel.toc
? manual/manual-html
? manual/manual-text
? manual/manual.aux
? manual/manual.dvi
? manual/manual.log
? manual/manual.tex
? manual/manual.toc
? manual/mk-src.tex
? manual/dev-html/Makefile
? manual/dev-html/Makefile.in
? manual/dev-html/WARNINGS
? manual/dev-html/devel.css
? manual/dev-html/devel.html
? manual/dev-html/index.html
? manual/dev-html/internals.pl
? manual/dev-html/labels.pl
? manual/dev-html/nx_grp_g.png
? manual/dev-html/prev_g.png
? manual/dev-html/up_g.png
? manual/dev-text/Makefile
? manual/dev-text/Makefile.in
? manual/dev-text/devel.txt
? manual/dev-text/index.txt
? manual/man-html/1_Introduction.html
? manual/man-html/2_Getting.html
? manual/man-html/3_Basic.html
? manual/man-html/4_Customizing.html
? manual/man-html/5_Working.html
? manual/man-html/6_Writing.html
? manual/man-html/7_Adding.html
? manual/man-html/8_How.html
? manual/man-html/A_Changelog.html
? manual/man-html/About_this.html
? manual/man-html/B_Do.html
? manual/man-html/C_Credits.html
? manual/man-html/Contents.html
? manual/man-html/D_Glossary.html
? manual/man-html/E_Copyright.html
? manual/man-html/Makefile
? manual/man-html/Makefile.in
? manual/man-html/WARNINGS
? manual/man-html/contents.png
? manual/man-html/crossref.png
? manual/man-html/index.html
? manual/man-html/internals.pl
? manual/man-html/labels.pl
? manual/man-html/manual.css
? manual/man-html/manual.html
? manual/man-html/next.png
? manual/man-html/next_g.png
? manual/man-html/prev.png
? manual/man-html/prev_g.png
? manual/man-html/up.png
? manual/man-html/up_g.png
? manual/man-text/1_Introduction.txt
? manual/man-text/2_Getting.txt
? manual/man-text/3_Basic.txt
? manual/man-text/4_Customizing.txt
? manual/man-text/5_Working.txt
? manual/man-text/6_Writing.txt
? manual/man-text/7_Adding.txt
? manual/man-text/8_How.txt
? manual/man-text/A_Changelog.txt
? manual/man-text/About_this.txt
? manual/man-text/B_Do.txt
? manual/man-text/C_Credits.txt
? manual/man-text/Contents.txt
? manual/man-text/D_Glossary.txt
? manual/man-text/E_Copyright.txt
? manual/man-text/Makefile
? manual/man-text/Makefile.in
? manual/man-text/index.txt
? manual/man-text/manual.txt
? modules/Makefile
? modules/Makefile.in
? modules/filter/.deps
? modules/filter/.libs
? modules/filter/Makefile
? modules/filter/Makefile.in
? modules/filter/email.lo
? modules/filter/libaspell-filter-standard.la
? modules/filter/sgml.lo
? modules/filter/tex.lo
? modules/filter/url.lo
? modules/speller/Makefile
? modules/speller/Makefile.in
? modules/speller/default/.deps
? modules/speller/default/.libs
? modules/speller/default/Makefile
? modules/speller/default/Makefile.in
? modules/speller/default/data.lo
? modules/speller/default/editdist.lo
? modules/speller/default/file_data_util.lo
? modules/speller/default/l2editdist.lo
? modules/speller/default/language.lo
? modules/speller/default/leditdist.lo
? modules/speller/default/libaspell-speller-default.la
? modules/speller/default/multi_ws.lo
? modules/speller/default/phonet.lo
? modules/speller/default/phonetic.lo
? modules/speller/default/primes.lo
? modules/speller/default/readonly_ws.lo
? modules/speller/default/speller_impl.lo
? modules/speller/default/split.lo
? modules/speller/default/suggest.lo
? modules/speller/default/typo_editdist.lo
? modules/speller/default/writable_base.lo
? modules/speller/default/writable_repl.lo
? modules/speller/default/writable_ws.lo
? modules/tokenizer/.deps
? modules/tokenizer/.libs
? modules/tokenizer/Makefile
? modules/tokenizer/Makefile.in
? modules/tokenizer/basic.lo
? modules/tokenizer/libaspell-tokenizer-standard.la
? prog/.deps
? prog/.libs
? prog/Makefile
? prog/Makefile.in
? prog/aspell
? prog/res
? prog/word-list-compress
? scripts/Makefile
? scripts/Makefile.in
? scripts/pspell-config
? scripts/run-with-aspell
Index: common/fstream.cpp
===================================================================
RCS file: /cvsroot/aspell/aspell/common/fstream.cpp,v
retrieving revision 1.5
diff -u -r1.5 fstream.cpp
--- common/fstream.cpp 23 Jul 2002 23:36:40 -0000 1.5
+++ common/fstream.cpp 18 Sep 2002 12:43:48 -0000
@@ -30,7 +30,7 @@
void FStream::close()
{
- if (file_ != 0)
+ if (file_ != 0 && own_)
fclose(file_);
file_ = 0;
}
Index: common/fstream.hpp
===================================================================
RCS file: /cvsroot/aspell/aspell/common/fstream.hpp,v
retrieving revision 1.7
diff -u -r1.7 fstream.hpp
--- common/fstream.hpp 22 Jul 2002 07:07:24 -0000 1.7
+++ common/fstream.hpp 18 Sep 2002 12:43:48 -0000
@@ -23,10 +23,13 @@
{
private:
FILE * file_;
+ bool own_;
public:
- FStream(char d = '\n') : IStream(d), file_(0) {}
- FStream(FILE * f) : IStream('\n'), file_(f) {}
+ FStream(char d = '\n')
+ : IStream(d), file_(0), own_(true) {}
+ FStream(FILE * f, bool own = true)
+ : IStream('\n'), file_(f), own_(own) {}
~FStream() {close();}
PosibErr<void> open(ParmString, const char *);
Index: common/iostream.cpp
===================================================================
RCS file: /cvsroot/aspell/aspell/common/iostream.cpp,v
retrieving revision 1.2
diff -u -r1.2 iostream.cpp
--- common/iostream.cpp 30 Nov 2001 03:55:46 -0000 1.2
+++ common/iostream.cpp 18 Sep 2002 12:43:48 -0000
@@ -7,7 +7,7 @@
#include "iostream.hpp"
namespace acommon {
- FStream CIN(stdin);
- FStream COUT(stdout);
- FStream CERR(stderr);
+ FStream CIN(stdin, false);
+ FStream COUT(stdout, false);
+ FStream CERR(stderr, false);
}