Issue24388
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2015-06-05 23:10 by emaste, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
readline.diff | emaste, 2015-06-05 23:10 | Initial patch to extend libedit compatibility to FreeBSD |
Messages (4) | |||
---|---|---|---|
msg244877 - (view) | Author: Ed Maste (emaste) | Date: 2015-06-05 23:10 | |
I encountered a segfault in Python's call_readline from LLDB on FreeBSD, with libedit. There is a fix for this issue already in readline.c, but under #ifdef __APPLE__ Backtrace: (lldb) target create "/data/emaste/src/llvm/build/bin/lldb" --core "lldb-3.7.0.core" Core file '/tank/emaste/projects/lldb-talk/demo/lldb-3.7.0.core' (x86_64) was loaded. (lldb) bt * thread #1: tid = 0, 0x0000000809706dcd readline.so`call_readline(sys_stdin=0x00000008055d9d10, sys_stdout=0x00000008055d9e40, prompt=0x0000000806eb7854) + 397 at readline.c:1132, name = 'lldb-3.7.0', stop reason = signal SIGSEGV * frame #0: 0x0000000809706dcd readline.so`call_readline(sys_stdin=0x00000008055d9d10, sys_stdout=0x00000008055d9e40, prompt=0x0000000806eb7854) + 397 at readline.c:1132 frame #1: 0x0000000805c48f1f libpython2.7.so.1`PyOS_Readline(sys_stdin=0x00000008055d9d10, sys_stdout=0x00000008055d9e40, prompt=0x0000000806eb7854) + 383 at myreadline.c:207 frame #2: 0x0000000805d7f94f libpython2.7.so.1`builtin_raw_input(self=0x0000000000000000, args=0x000000080bec1df0) + 639 at bltinmodule.c:2060 frame #3: 0x0000000805cce5c6 libpython2.7.so.1`PyCFunction_Call(func=0x00000008007b78d0, arg=0x000000080bec1df0, kw=0x0000000000000000) + 166 at methodobject.c:81 frame #4: 0x0000000805d992aa libpython2.7.so.1`call_function(pp_stack=0x00007fffffffbcd0, oparg=1) + 1754 at ceval.c:4033 frame #5: 0x0000000805d93538 libpython2.7.so.1`PyEval_EvalFrameEx(f=0x0000000806ecfdf0, throwflag=0) + 51160 at ceval.c:2679 frame #6: 0x0000000805d86c54 libpython2.7.so.1`PyEval_EvalCodeEx(co=0x0000000805a6af60, globals=0x0000000806f9a580, locals=0x0000000000000000, args=0x000000080a06c670, argcount=2, kws=0x000000080a06c680, kwcount=0, defs=0x0000000805aaeda8, defcount=1, closure=0x0000000000000000) + 5284 at ceval.c:3265 frame #7: 0x0000000805d9c2b6 libpython2.7.so.1`fast_function(func=0x0000000806f7da38, pp_stack=0x00007fffffffc520, n=2, na=2, nk=0) + 822 at ceval.c:4129 frame #8: 0x0000000805d994c8 libpython2.7.so.1`call_function(pp_stack=0x00007fffffffc520, oparg=1) + 2296 at ceval.c:4054 frame #9: 0x0000000805d93538 libpython2.7.so.1`PyEval_EvalFrameEx(f=0x000000080a06c4b0, throwflag=0) + 51160 at ceval.c:2679 frame #10: 0x0000000805d86c54 libpython2.7.so.1`PyEval_EvalCodeEx(co=0x0000000805a5ebf0, globals=0x0000000806f9a580, locals=0x0000000000000000, args=0x000000080a06c3e0, argcount=2, kws=0x000000080a06c3f0, kwcount=0, defs=0x0000000805aaecc8, defcount=1, closure=0x0000000000000000) + 5284 at ceval.c:3265 frame #11: 0x0000000805d9c2b6 libpython2.7.so.1`fast_function(func=0x0000000806f7d8e8, pp_stack=0x00007fffffffcd70, n=2, na=2, nk=0) + 822 at ceval.c:4129 frame #12: 0x0000000805d994c8 libpython2.7.so.1`call_function(pp_stack=0x00007fffffffcd70, oparg=1) + 2296 at ceval.c:4054 frame #13: 0x0000000805d93538 libpython2.7.so.1`PyEval_EvalFrameEx(f=0x000000080a06c230, throwflag=0) + 51160 at ceval.c:2679 frame #14: 0x0000000805d86c54 libpython2.7.so.1`PyEval_EvalCodeEx(co=0x0000000805a869e0, globals=0x0000000806f9a580, locals=0x0000000000000000, args=0x000000080a06b9f8, argcount=0, kws=0x000000080a06b9f8, kwcount=2, defs=0x00000008009af688, defcount=3, closure=0x0000000000000000) + 5284 at ceval.c:3265 frame #15: 0x0000000805d9c2b6 libpython2.7.so.1`fast_function(func=0x0000000806f7d300, pp_stack=0x00007fffffffd5c0, n=4, na=0, nk=2) + 822 at ceval.c:4129 frame #16: 0x0000000805d994c8 libpython2.7.so.1`call_function(pp_stack=0x00007fffffffd5c0, oparg=512) + 2296 at ceval.c:4054 frame #17: 0x0000000805d93538 libpython2.7.so.1`PyEval_EvalFrameEx(f=0x000000080a06b830, throwflag=0) + 51160 at ceval.c:2679 frame #18: 0x0000000805d9c16a libpython2.7.so.1`fast_function(func=0x0000000806f9d300, pp_stack=0x00007fffffffdbd0, n=1, na=1, nk=0) + 490 at ceval.c:4119 frame #19: 0x0000000805d994c8 libpython2.7.so.1`call_function(pp_stack=0x00007fffffffdbd0, oparg=1) + 2296 at ceval.c:4054 frame #20: 0x0000000805d93538 libpython2.7.so.1`PyEval_EvalFrameEx(f=0x000000080098c9c0, throwflag=0) + 51160 at ceval.c:2679 frame #21: 0x0000000805d86c54 libpython2.7.so.1`PyEval_EvalCodeEx(co=0x00000008008ffa90, globals=0x00000008007d8580, locals=0x00000008007d8580, args=0x0000000000000000, argcount=0, kws=0x0000000000000000, kwcount=0, defs=0x0000000000000000, defcount=0, closure=0x0000000000000000) + 5284 at ceval.c:3265 frame #22: 0x0000000805d857a5 libpython2.7.so.1`PyEval_EvalCode(co=0x00000008008ffa90, globals=0x00000008007d8580, locals=0x00000008007d8580) + 85 at ceval.c:667 frame #23: 0x0000000805dd4a15 libpython2.7.so.1`run_mod(mod=0x000000080a14f128, filename=0x0000000805e22022, globals=0x00000008007d8580, locals=0x00000008007d8580, flags=0x0000000000000000, arena=0x000000080a027800) + 101 at pythonrun.c:1371 frame #24: 0x0000000805dd50a4 libpython2.7.so.1`PyRun_StringFlags(str=0x000000080a0ff820, start=257, globals=0x00000008007d8580, locals=0x00000008007d8580, flags=0x0000000000000000) + 148 at pythonrun.c:1334 frame #25: 0x0000000805dd4f54 libpython2.7.so.1`PyRun_SimpleStringFlags(command=0x000000080a0ff820, flags=0x0000000000000000) + 100 at pythonrun.c:975 frame #26: 0x0000000802085fa4 liblldb.so.3.7`IOHandlerPythonInterpreter::Run() + 324 frame #27: 0x0000000801f78c12 liblldb.so.3.7`lldb_private::Debugger::ExecuteIOHandlers() + 162 frame #28: 0x000000080206635e liblldb.so.3.7`lldb_private::CommandInterpreter::RunCommandInterpreter(bool, bool, lldb_private::CommandInterpreterRunOptions&) + 126 frame #29: 0x00000008012bc79f liblldb.so.3.7`lldb::SBDebugger::RunCommandInterpreter(bool, bool) + 63 frame #30: 0x0000000000406546 lldb`Driver::MainLoop() + 2454 frame #31: 0x0000000000406a17 lldb`main + 439 frame #32: 0x000000000040362f lldb`_start + 367 frame #0: 0x0000000809706dcd readline.so`call_readline(sys_stdin=0x00000008055d9d10, sys_stdout=0x00000008055d9e40, prompt=0x0000000806eb7854) + 397 at readline.c:1132 1129 line = history_get(length + libedit_history_start - 1)->line; 1130 } else 1131 #endif /* __APPLE__ */ -> 1132 line = history_get(length)->line; 1133 else 1134 line = ""; 1135 if (strcmp(p, line)) It looks like a straightforward s/#ifdef __APPLE__/#if defined(__APPLE__) || defined(__FreeBSD__)/ fixes the issue (as in the attached proof of concept patch). |
|||
msg244878 - (view) | Author: Ed Maste (emaste) | Date: 2015-06-05 23:22 | |
Presumably the #ifdefs ought to just be deleted though, relying on the runtime detection of libedit compatibility issues on any platform. |
|||
msg244879 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2015-06-06 01:38 | |
See also Issue 13501 for a more platform-independent approach. I think this crash is actually due to a bug in Editline (later fixed; see Issue 18458), but since Python already has the workaround, it makes sense to use the workaround if necessary for Free BSD, or maybe even in general. |
|||
msg244881 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2015-06-06 01:57 | |
The change in spec in editline was to better match GNU readline behavior. Unfortunately, we depended on the old behavior. Technically, we don't support editline out-of-the-box other than on OS X; as Martin notes, generalizing that support is what Issue13501 is about. I'm going to close this as a duplicate of it. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:17 | admin | set | github: 68576 |
2021-08-28 20:17:54 | ned.deily | set | pull_requests: - pull_request26463 |
2021-08-28 20:10:30 | DonnaDia | set | nosy:
+ DonnaDia pull_requests: + pull_request26463 |
2015-06-06 01:57:22 | ned.deily | set | status: open -> closed superseder: Make libedit support more generic; port readline / libedit to FreeBSD nosy: + ned.deily messages: + msg244881 resolution: duplicate stage: resolved |
2015-06-06 01:38:07 | martin.panter | set | type: crash messages: + msg244879 nosy: + martin.panter |
2015-06-05 23:22:10 | emaste | set | messages: + msg244878 |
2015-06-05 23:10:28 | emaste | create |