Subject: | segv if attempted completion function returns undef in pos 0 |
See subject: I'm sure this is user error, but it should not lead to segv.
To reproduce it:
#!perl
use v5.20.0;
use warnings;
use utf8;
use Term::ReadLine;
my $term = Term::ReadLine->new('bar');
$term->Attribs->{attempted_completion_function} = \&which;
while (defined (my $line = $term->readline('> '))) {
say "INPUT: <$line>";
}
sub which {
return (undef, "abc", "def");
}
Subject: | checkver.txt |
1..4
ok 1 - load done
# I'm testing Term::ReadLine::Gnu version 1.36
ok 2 - An object of class 'Term::ReadLine' isa 'Term::ReadLine'
ok 3 - 'Attribs' isa 'Term::ReadLine'
# OS: darwin
# Perl version: 5.030001
# GNU Readline Library version: 8.0, 0x800
# $TERM=xterm-256color
ok 4 - library_version and readline_version
Subject: | make-verb.txt |
Found `/opt/local/lib/libtermcap.dylib'.
cc -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV rlver.c -o rlver -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/opt/local/lib -lreadline -ltermcap
<<<It seems that you have the GNU Readline Library version 8.0.>>>
cc -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -DTRG_READLINE_VERSION=0x0800 rlmalloc.c -o rlmalloc -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/opt/local/lib -lreadline -ltermcap
Checking if your kit is complete...
Looks good
ABSTRACT_FROM => q[Gnu.pm]
AUTHOR => [q[Hiroo HAYASHI <hiroo.hayashi@computer.org>]]
BUILD_REQUIRES => { }
CONFIGURE_REQUIRES => { }
DEFINE => q[ -DTRG_READLINE_VERSION=0x0800]
EXE_FILES => [q[eg/perlsh]]
INC => q[]
LDDLFLAGS => q[ -mmacosx-version-min=10.15 -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector-strong]
LIBS => [q[ -lreadline -ltermcap]]
LICENSE => q[perl]
META_MERGE => { resources=>{ bugtracker=>q[http://rt.cpan.org/Public/Dist/Term-ReadLine-Gnu], homepage=>q[http://sourceforge.net/projects/perl-trg/], license=>q[http://dev.perl.org/licenses/], repository=>q[https://sourceforge.net/p/perl-trg/code/HEAD/tree/] } }
MIN_PERL_VERSION => q[5.008001]
NAME => q[Term::ReadLine::Gnu]
PREREQ_PM => { }
TEST_REQUIRES => { }
VERSION_FROM => q[Gnu.pm]
clean => { FILES=>q[rlver.c rlver rlmalloc.c rlmalloc] }
dist => { COMPRESS=>q[gzip -9f], SUFFIX=>q[gz] }
dynamic_lib => { OTHERLDFLAGS=>q[] }
Using PERL=/Users/rjbs/.plenv/versions/30.1/bin/perl5.30.1
Generating a Unix-style Makefile
Writing Makefile for Term::ReadLine::Gnu
Writing MYMETA.yml and MYMETA.json
Subject: | perl-v.txt |
Summary of my perl5 (revision 5 version 30 subversion 1) configuration:
Platform:
osname=darwin
osvers=19.2.0
archname=darwin-2level
uname='darwin mimsy.fios-router.home 19.2.0 darwin kernel version 19.2.0: sat nov 9 03:47:04 pst 2019; root:xnu-6153.61.1~20release_x86_64 x86_64 '
config_args='-Dprefix=/Users/rjbs/.plenv/versions/30.1 -de -Dversiononly -A'eval:scriptdir=/Users/rjbs/.plenv/versions/30.1/bin''
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='cc'
ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV'
optimize='-O3'
cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include'
ccversion=''
gccversion='4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)'
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 =' -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/opt/local/lib'
libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib /opt/local/lib /usr/lib
libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
perllibs=-lpthread -ldl -lm -lutil -lc
libc=
so=dylib
useshrplib=false
libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=bundle
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' -mmacosx-version-min=10.15 -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Locally applied patches:
Devel::PatchPerl 1.52
Built under darwin
Compiled at Feb 4 2020 15:53:46
%ENV:
PERLDOC="-otext"
PERL_AUTOINSTALL="--skipdeps"
PERL_MAILERS="sendmail:/Users/rjbs/bin/sendmail"
@INC:
/Users/rjbs/.plenv/versions/30.1/lib/perl5/site_perl/5.30.1/darwin-2level
/Users/rjbs/.plenv/versions/30.1/lib/perl5/site_perl/5.30.1
/Users/rjbs/.plenv/versions/30.1/lib/perl5/5.30.1/darwin-2level
/Users/rjbs/.plenv/versions/30.1/lib/perl5/5.30.1