I am writing to report a potential bug. To reproduce:
:python print "hello"
This gives me a segmentation fault. A few other arch linux users have
confirmed the issue, and noted that other python commands still function:
Here is the version information:
Please let me know anything I can do to help. Thanks.
FYI, my vim 7.3.494 doesn't crash. I'm also using Arch Linux (64bit) but
the Python 2.7 is dynamic loaded.
Linux Vim Python 我的博客:
A: Because it obfuscates the reading.
Q: Why is top posting so bad?
I was going to report this when I had more time to debug, but since
people are already posting it here, I will submit what I have.
Yesterday I had a segfault with vim + neocomplcache turned on while
editing a file (reproducible).
The stack trace from that is at: https://gist.github.com/2377278
I can confirm the segfault with :python print "hello"
The stack trace is at: https://gist.github.com/2377276
They crash in the same location:
#0 0x00007ffff4b3f578 in memchr () from /lib/libc.so.6
#1 0x00000000005a96e8 in writer (fn=0x4d5f70 <msg>, str=0x0, n=2) at
#2 0x00000000005a9912 in OutputWrite (self=<optimized out>,
args=<optimized out>) at if_py_both.h:82
Hope this helps for now.
I am having this same issue with Arch x86_64 and gvim 7.3.495.
Downgrading to 7.3.475 fixes this. However, rebuilding 475 from source has the same issue as 495.
Hi, I have updated the source code and tried again, no crash as before.
But the binary from Arch's official package does crash. Also, I tried
using nearly the same config as the Arch one (only one extra '-g' passed
as CFLAGS), it doesn't crash, either.
I really don't know the interface between Vim and python but I wonder
why str is null.
This patch guards against str being Null and should therefore prevent
However, this just means :python print "hello" won't return anything, so
possibly parsing the argument gets wrong somewhere before.
diff --git a/src/if_py_both.h b/src/if_py_both.h
@@ -74,7 +74,7 @@
char *str = NULL;
int error = ((OutputObject *)(self))->error;
- if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len))
+ if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len) || str == NUL)
Breakpoint 1, OutputWrite (self=0x83d2e0, args=0x7ffff7eda4d0) at
77 in if_py_both.h
(gdb) info locals
len = 0
str = 0x7ffff4703cb0 "g6"
error = <optimized out>
Breakpoint 2, OutputWrite (self=<optimized out>, args=<optimized out>)
80 in if_py_both.h
(gdb) info locals
_save = <optimized out>
len = 8
str = 0x0
error = 0
It seems that str is for some reason getting set to null even if
everything appears to be ok..
Nick's comment also makes me think it might possibly have something to
do with the recent gcc 4.7 update.
Hi, I just upgraded those packages and compiled if_python.o again, and
I got the same crash. However, it won't crash if I add CFLAGS=-g then
I couldn't reproduce this and it still crashes for me with
If you could, can you see if you can get the vim PKGBUILD to build
without the segfault?
This will provide a point of reference so I can see what are the exact
changes that are needed to stop the segfault.
After makepkg, I remove gvim-build/src/objects/if_python.o and then run
'make CFLAGS=-g' in 'gvim-build', the resulting 'src/vim' won't crash.
Nothing in PKGBUILD changed except that I commented out the commands
building no-GUI vim since it doesn't support Python.
Avoiding a crash is always good. But perhaps there is a better
ARTHUR: Be quiet!
DENNIS: Well you can't expect to wield supreme executive power just 'cause
some watery tart threw a sword at you!
ARTHUR: Shut up!
DENNIS: I mean, if I went around sayin' I was an empereror just because some
moistened bint had lobbed a scimitar at me they'd put me away!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
After exporting the flags with -g as lilydjwg suggested, :python print
"hello" didn't segfault vim.
I am still getting the segfault when trying to autocomplete the string
"collections." with neocomplcache.
The full backtrace (which is different than the original) when it
crashes is at https://gist.github.com/2422281
Ok, I'm getting closer to figuring this out, it's caused by having the
-O2 flag there. If you remove -O2 from CFLAGS, there is no crash. I'm
guessing this has something to do with gcc 4.7.0 possibly
make one suspicious. It might be that there is some "lucky" code.
It looks like this was caused by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53084.