# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #41103]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41103 >


According to src/pmc/parrotio.pmc, the 'readline'() method for
parrot I/O objects seems like it ought to work even when
readline is not present (PARROT_HAS_READLINE, starting at
approx line 179).

However, it appears to segfault when readline isn't present, as
demonstrated by this test program:

    $ cat readline.pir
    .sub main :main
        .local pmc stdin
    
        stdin = getstdin
        $I0 = stdin.'set_readline_interactive'(1)
    
        $P0 = stdin.'readline'('> ')
        say $P0
    .end
    $ ./parrot readline.pir
    hello
    Segmentation fault

The gdb backtrace shows:

    ...
    #0  0x00002b9f6f414e1e in clone_key_arg (interp=0x50c010, st=0x7fff3b9c1020)
        at src/inter_call.c:600
    600         if (p_arg && p_arg->vtable->base_type == enum_class_Key) {
    (gdb) bt
    #0  0x00002b9f6f414e1e in clone_key_arg (interp=0x50c010, st=0x7fff3b9c1020)
        at src/inter_call.c:600
    #1  0x00002b9f6f416320 in Parrot_convert_arg (interp=0x50c010,
        st=0x7fff3b9c1020) at src/inter_call.c:1059
    #2  0x00002b9f6f447154 in set_nci_P (interp=0x50c010, st=0x7fff3b9c1020,
        val=0x78e3b0) at src/nci.c:135
    #3  0x00002b9f6f447aa4 in pcf_P_JOS (interp=0x50c010, self=0x543eb0)
        at src/nci.c:373
    #4  0x00002b9f6f4a92c3 in Parrot_NCI_invoke (interp=0x50c010, pmc=0x543eb0,
        next=0x825d30) at src/pmc/nci.pmc:146
    #5  0x00002b9f6f354f24 in Parrot_callmethodcc_p_sc (cur_opcode=0x825d18,
        interp=0x50c010) at src/ops/object.ops:65
    #6  0x00002b9f6f42acc1 in runops_slow_core (interp=0x50c010, pc=0x825d18)
        at src/runops_cores.c:184
    #7  0x00002b9f6f412dda in runops_int (interp=0x50c010, offset=0)
        at src/interpreter.c:775
    #8  0x00002b9f6f41869e in runops (interp=0x50c010, offs=0)
        at src/inter_run.c:87
    #9  0x00002b9f6f418938 in runops_args (interp=0x50c010, sub=0x7e76a8,
        obj=0x550350, meth=0x0, sig=0x2b9f6f547a02 "vP", ap=0x7fff3b9c1340)
        at src/inter_run.c:193
    #10 0x00002b9f6f418b2b in Parrot_runops_fromc_args (interp=0x50c010,
        sub=0x7e76a8, sig=0x2b9f6f547a02 "vP") at src/inter_run.c:295
    #11 0x00002b9f6f438ba8 in Parrot_runcode (interp=0x50c010, argc=1,
        argv=0x7fff3b9c1660) at src/embed.c:806
    #12 0x0000000000403596 in main (argc=1, argv=0x7fff3b9c1660)
        at compilers/imcc/main.c:723
    (gdb)
   
Pm 

Reply via email to