develooper Front page | perl.perl5.porters | Postings from January 2001

[ID 20010130.012] perldebug doesn't work in CGI environment

From:
root
Date:
January 30, 2001 15:34
Subject:
[ID 20010130.012] perldebug doesn't work in CGI environment
Message ID:
200101302334.SAA07254@corona.chelsea.net
This is a bug report for perl from davidb@chelsea.net,
generated with the help of perlbug 1.26 running under perl 5.00503.


-----------------------------------------------------------------
[Please enter your report here]

Howdy, we're trying to debug a very difficult problem involving 
a resident perl application running under FastCGI.  We're running
out of options, and need to really have the thing running in the
debugger whilst it's taking in requests, as it has to do with
some sort of bug in our code.

Through experimentation, I've been trying to get the TTY feature
of the debugger working.  Alas, it seems to be impossible to get
past various ReadLine-related problems.  By using a .perldb with
one minor fix, to look for the .perldb file in the home directory
of the user when $HOME and $LOGDIR is not set:

*** perl5db.pl  Tue Jan 30 18:30:38 2001
--- /usr/local/src/perl/5.005_03/lib/perl5db.pl Mon Dec 28 09:55:36 1998
***************
*** 256,266 ****
      do "$ENV{LOGDIR}/$rcfile";
  } elsif (defined $ENV{HOME} and -f "$ENV{HOME}/$rcfile") {
      do "$ENV{HOME}/$rcfile";
- } else {
-     my $dir = ( getpwuid( $< ) )[7];
-     if ( -f "$dir/.perldb" ) {
-         do "$dir/.perldb";
-     }
  }

  if (defined $ENV{PERLDB_OPTS}) {
--- 256,261 ----

I can get the application to recognize that another TTY is where
the debugging interface should point.  And it starts.

However, the application immediately terminates, and it appears
to be due to some sort of interaction with Term::ReadLine or
Term::ReadKey.  Even though $tty is set, ReadKey appears to be
trying to do a GetWindowSize on "/dev/tty", and I'm not sure 
exactly where (or why) that's called.  GetWindowSize contains
a "die", which causes the whole thing to abort.  I've traced
through the perl5db code as best as I can, and it seems like it
is doing the right thing, passing $tty into $IN and $OUT.

At this point, I'm starting to go underwater, so any advice or
pointers as to how exactly to attack this would be appreciated.
Or even better, a simple patch that I'm missing.  My next task
will be to turn off that "die" and see if things just work...but
there is probably a more elegant solution and a bug to fix!

Many thanks,

David.


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by davidb at Thu Sep 16 17:27:05 EDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos corona 5.6 generic_105181-12 sun4u sparc sunw,ultra-2 '
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/include -I/opt/db/1.85/include'
    ccflags ='-I/usr/local/include -I/opt/db/1.85/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-L/usr/local/lib -L/opt/db/1.85/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib /opt/db/1.85/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -L/opt/db/1.85/lib'

Locally applied patches:
    

---
@INC for perl 5.00503:
    /opt/perl/5.005_03/lib/perl/sun4-solaris
    /opt/perl/5.005_03/lib/perl
    /opt/siteperl/5.005_03/siteperl/sun4-solaris
    /opt/siteperl/5.005_03/siteperl
    .

---
Environment for perl 5.00503:
    HOME=/home/davidb
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About