On 7 Jan 2000, Niels Möller wrote:
> > Case 1. Not having zlib-dev package.
> I'll move the #if WITH_ZLIB to the top of the file, as you suggest. I
> didn't do that earlier, because I didn't think it was that easy to get
> it to compile without zlib ;)
Great.

> > Case 2. Having zlib-dev package
> > Config started: ./configure                 --> (no zlib support asked for)
> > When client started the server dies with "Segmentation fault", if there is
> > zlib.h and libz during compilation.
> 
> That sounds serious. How can I reproduce it? Did you compile both
> the client and the server with zlib support? That's been working for
> me for a long time. Or did you compile only one of them with zlib? I'd
> like to know the details.
I simply 'tar xfz lsh-0.2.1.tar.gz', 'cd lsh-0.2.1', './configure',
'make', 'cd src', './lshd -p 4711 -v --debug --trace --enable-core' and in
an other terminal from the _same_ directory (the same build)
'./lsh -z -p 4711 localhost' and I get the segfault in lshd. I tried it
with a libz compiled from the downloaded zlib-1.1.3 source, but it didn't
help.
BUT: The life gets more complex... If I start the server _only_ with
'./lshd -p 4711' and run the client with './lsh -z -p 4711 localhost'
(same as above) then I get the segfault in the _client_ (but in the same
place in the do_zlib function).
So what is the difference? I traced it to:
- if the server was started with the '-v' parameter then the server
segfaults.
- if the server was started without the '-v' parameter then the clients
segfaults.
Hey! This seems to be an obscure bug. ;) What the hack correlates
verbosity and segfault in the zlib glue code? 
(BTW I get the same problem on a SuSE 5.3 with libc5.4.46, zlib1.1.3,
gcc2.7.2.1, GDB 4.16.patched (i486-unknown-linux --target i486-linux),
gmp2.0.2, but unfortunately its coredump somehow isn't back traceable by
gdb...)

So let's run the programs in gdb:
- if the server is started with '-v': lshd reaches do_zlib first time and
in zlib.c at line 156 segfaults because self->f is 0. (Oooops.) lsh hasn't
reached do_zlib yet!
- if the server is started without '-v': _lsh_ reaches do_zlib first time
and in zlib.c at line 156 segfaults because self->f is 0. But _lshd_
hasn't reached do_zlib yet!
But why does the verbosity affect who wants first (de)compressing? Maybe
this is a dead end, but interesting... ;)
So the other way to go is why self->f is 0? In make_zlib_* I can't find
the assignment. Indeed I can't find it anywhere...
Looking in zlib.c after the segfaulting line there is:
      if (rc != Z_OK)
        {
          werror("do_zlib: deflate() or inflate() failed: %z\n",
                 self->z.msg ? self->z.msg : "No error(?)"); 
Hmmm. In the src directory 'grep inflate *' -> nowhere assigned.
'grep deflate *' -> nowhere assigned as well... Then how should lsh/lshd
know what to call in case of (de)compression?

Greets,
Keresztg

+ Keresztfalvi Gabor
+ Student of the Technical University of Budapest
+ mailto: [EMAIL PROTECTED]  [EMAIL PROTECTED]
+ http://www.sch.bme.hu/~keresztg/




Reply via email to