Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.96k stars 555 forks source link

perldb requires Term::Rendezvous if the 'noTTY' option is set, but it is unavailable (anywhere?) #22241

Open djerius opened 5 months ago

djerius commented 5 months ago

Module: perl5db.pl

Description

Term::Rendezvous is required when the noTTY option is specified, but it is not available either in the standard distribution or on CPAN.

% cpanm Term::Rendezvous                                                                                                               
! Finding Term::Rendezvous on cpanmetadb failed.
! Finding Term::Rendezvous () on mirror file:///proj/axaf/simul/export/darkpan failed.                                                       
! Finding Term::Rendezvous () on mirror https://cpan.org failed.
! Couldn't find module or a distribution Term::Rendezvous

Steps to Reproduce

% PERLDB_OPTS='noTTY' perl -dE '$DB::single=1; require POSIX'
Can't locate Term/Rendezvous.pm in @INC (you may need to install the Term::Rendezvous module)
(@INC entries checked:
[...]/lib/perl5/x86_64-linux_RHEL-8-thread-multi
[...]/lib/perl5
[...]/lib/site_perl/5.38.2/x86_64-linux_RHEL-8-thread-multi
[...]/lib/site_perl/5.38.2
[...]/lib/5.38.2/x86_64-linux_RHEL-8-thread-multi
[...]/lib/5.38.2
at [...]/lib/5.38.2/perl5db.pl line 6854.
        DB::setterm() called at [...]/lib/5.38.2/perl5db.pl line 1849
        DB::_DB__read_next_cmd(undef) called at [...]/lib/5.38.2/perl5db.pl line 3100
        DB::DB called at -e line 1
[...]
END failed--call queue aborted.
 at -e line 0.

Expected behavior

Either Term::Rendezvous should ship with Perl or it should be available on CPAN.

Perl configuration

Summary of my perl5 (revision 5 version 38 subversion 2) configuration:

  Platform:
    osname=linux
    osvers=4.18.0-477.27.1.el8_8.x86_64
    archname=x86_64-linux_RHEL-8-thread-multi
    uname='linux jeeves-new.cfa.harvard.edu 4.18.0-477.27.1.el8_8.x86_64 #1 smp thu aug 31 10:29:22 edt 2023 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dprefix=/home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-base -de -Dversiononly -Dprefix=/proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8 -Dperladmin=none -Dlocincpth=/proj/axaf/ots/include -Darchname=x86_64-linux_RHEL-8 -Dusethreads -Dotherlibdirs=/proj/axaf/simul/lib/perl5:/proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5 -Dloclibpth=/proj/axaf/ots/x86_64-linux_RHEL-8/lib -Dglibpth=/lib /usr/lib -Dldflags=-L/proj/axaf/ots/x86_64-linux_RHEL-8/lib -Wl,-rpath=/proj/axaf/ots/x86_64-linux_RHEL-8/lib -Duseshrplib -Uinstallusrbinperl -A'eval:scriptdir=/home/dj/.plenv/x86_64-linux_RHEL-8/versions/5.38-base/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/proj/axaf/ots/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/proj/axaf/ots/include'
    ccversion=''
    gccversion='8.5.0 20210514 (Red Hat 8.5.0-18)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags ='-L/proj/axaf/ots/x86_64-linux_RHEL-8/lib -Wl,-rpath=/proj/axaf/ots/x86_64-linux_RHEL-8/lib -fstack-protector-strong'
    libpth=/stage/local.rhel8/lib /usr/lib /proj/axaf/ots/x86_64-linux_RHEL-8/lib /usr/lib64
    libs=-lpthread -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.28.so
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version='2.28'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E -Wl,-rpath,/proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8/lib/5.38.2/x86_64-linux_RHEL-8-thread-multi/CORE'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/proj/axaf/ots/x86_64-linux_RHEL-8/lib -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Built under linux
  Compiled at Jan 18 2024 21:01:00
  %ENV:
    PERL5LIB="/proj/axaf/simul/lib/perl5:/proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5:/home/dj/research/lib/perl5"
    PERL_CPANM_HOME="/tmp/dj/cpanm"
    PERL_CPANM_OPT="--cascade --mirror /proj/axaf/simul/export/darkpan --mirror https://cpan.org"
    PERL_CPAN_MIRROR_TINY_BASE="/proj/axaf/simul/export/darkpan"
  @INC:
    /proj/axaf/simul/lib/perl5
    /proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5/x86_64-linux_RHEL-8-thread-multi
    /proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5
    /home/dj/research/lib/perl5
    /proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8/lib/site_perl/5.38.2/x86_64-linux_RHEL-8-thread-multi
    /proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8/lib/site_perl/5.38.2
    /proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8/lib/5.38.2/x86_64-linux_RHEL-8-thread-multi
    /proj/axaf/ots/pkgs/perl-5.38/x86_64-linux_RHEL-8/lib/5.38.2
    /proj/axaf/simul/lib/perl5
    /proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5/x86_64-linux_RHEL-8-thread-multi
    /proj/axaf/simul/x86_64-linux_RHEL-8/lib/perl5
haarg commented 5 months ago

This has been in the debugger since it was introduced, but I can't see any trace of Term::Rendezvous ever existing on CPAN.

tonycoz commented 5 months ago

@shlomif suggested it's something you're meant to provide yourself, which should be documented if it's the intention. Or fixed.

I doubt we'd do this with a fixed class name today.

jkeenan commented 2 months ago

If there's anyone who would like a meaningful project involving the Perl debugger, please step forward.

The else block starting at 6894 of lib/perl5db.pl is what needs reformulation:

 6881     # If noTTY is set, but we have a TTY name, go ahead and hook up to it.
 6882     if ($notty) { 
 6883         if ($tty) {
 6884             my ( $i, $o ) = split $tty, /,/;
 6885             $o = $i unless defined $o;
 6886             open( IN,  '<', $i ) or die "Cannot open TTY '$i' for read: $!";
 6887             open( OUT, '>', $o ) or die "Cannot open TTY '$o' for write: $!";
 6888             $IN  = \*IN;
 6889             $OUT = \*OUT;
 6890             _autoflush($OUT);
 6891         } ## end if ($tty)
 6892         
 6893         # We don't have a TTY - try to find one via Term::Rendezvous.
 6894         else {
 6895             require Term::Rendezvous;
 6896             
 6897             # See if we have anything to pass to Term::Rendezvous.
 6898             # Use $HOME/.perldbtty$$ if not.
 6899             my $rv = $ENV{PERLDB_NOTTY} || "$ENV{HOME}/.perldbtty$$";
 6900             
 6901             # Rendezvous and get the filehandles.
 6902             my $term_rv = Term::Rendezvous->new( $rv );
 6903             $IN  = $term_rv->IN;
 6904             $OUT = $term_rv->OUT;
 6905         } ## end else [ if ($tty)
 6906     } ## end if ($notty)
 6907