Segfault running toplevel for old CentOS 6 system

swipl segfaults on CentOS 6 (yes I know it is EOL) when using editline, if I switch it to readline (with .swiplrc/init.pl) it starts fine.

The crash happens with 8.2.0 stable also. I compiled with two different versions of gcc ( 7.3.1 and 9.1.1).

Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.26)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).


SWI-Prolog [thread 1 (main) at Mon Jul 12 01:44:11 2021]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
  [0] save_backtrace() at /tmp/swipl-devel/src/os/pl-cstack.c:333 [0x7fc3859eebae]
  [1] print_c_backtrace() at /tmp/swipl-devel/src/os/pl-cstack.c:868 [0x7fc3859eeccf]
  [2] sigCrashHandler() at /tmp/swipl-devel/src/os/pl-cstack.c:906 [0x7fc3859eedd6]
  [3] dispatch_signal() at /tmp/swipl-devel/src/pl-setup.c:564 [0x7fc3859662a0]
  [4] __restore_rt() at sigaction.c:0 [0x7fc3854e9570]
  [5] __strcmp_sse42() at thread-freeres.c:0 [0x7fc3855df716]
  [6] ??() at ??:0 [0x7fc37d80ed24]
  [7] ??() at ??:0 [0x7fc37d80e622]
  [8] ??() at ??:0 [0x7fc37d80c077]
  [9] pl_bind() at /tmp/swipl-devel/packages/libedit/libedit4pl.c:1260 [0x7fc38589ae7a]
  [10] PL_next_solution() at /tmp/swipl-devel/src/pl-vmi.c:4614 [0x7fc38590c4e9]
  [11] callProlog() at /tmp/swipl-devel/src/pl-pro.c:405 [0x7fc38594c10d]
  [12] pl_sig_atomic1_va() at /tmp/swipl-devel/src/pl-pro.c:309 [0x7fc38594c2f2]
  [13] PL_next_solution() at /tmp/swipl-devel/src/pl-vmi.c:4583 [0x7fc38590a1e6]
  [14] query_loop() at /tmp/swipl-devel/src/pl-pro.c:155 [0x7fc38594bcb2]
  [15] prologToplevel() at /tmp/swipl-devel/src/pl-pro.c:497 [0x7fc38594c4bb]
  [16] PL_toplevel() at /tmp/swipl-devel/src/pl-fli.c:4699 [0x7fc3859c742e]
  [17] swipl(+0x10a5) [0x4010a5]
  [18] __libc_start_main() at ??:0 [0x7fc3854d5d20]
  [19] swipl(+0x10e9) [0x4010e9]
Prolog stack:
  [32] editline:el_bind/2 [PC=1 in supervisor]
  [31] editline:add_prolog_commands/1 [PC=49 in clause 1]
  [30] editline:el_wrap/0 [PC=25 in clause 2]
  [29] system:$run_init_goal/1 [PC=10 in clause 1]
  [28] system:catch/3 [PC=2 in clause 1]
  [27] system:catch_with_backtrace/3 [PC=6 in clause 1]
  [26] system:$run_init_goal/2 [PC=22 in clause 1]
  [25] system:$run_initialization_2/1 [PC=21 in clause 1]
  [24] system:setup_call_catcher_cleanup/4 [PC=5 in clause 1]
  [18] system:setup_call_catcher_cleanup/4 [PC=5 in clause 1]
  [16] system:$c_call_prolog/0 [PC=0 in top query clause]
  [15] system:$sig_atomic/1 <foreign>
  [12] system:$load_file/3 [PC=12 in clause 1]
  [8] system:catch/3 [PC=2 in clause 1]
  [6] $toplevel:setup_readline/0 [PC=77 in clause 1]
  [5] system:catch/3 [PC=2 in clause 1]
  [4] $toplevel:setup_interactive/0 [PC=30 in clause 2]
  [2] $toplevel:$runtoplevel/0 [PC=12 in clause 1]
  [1] $toplevel:$toplevel/0 [PC=3 in clause 1]
  [0] system:$c_call_prolog/0 [PC=0 in top query clause]

EDIT: Forgot to mention libedit-devel is version 2.11-4.20080712cvs.1.el6

I’m surprised it even works :slight_smile: