Bug 817196 - Running :python commands in vim causes a segfault
Running :python commands in vim causes a segfault
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: vim (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Karsten Hopp
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-27 21:43 EDT by Tim Cuthbertson
Modified: 2012-10-31 06:23 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-31 06:23:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
backtrace from dumped core (using gdb) (5.65 KB, text/plain)
2012-04-27 21:43 EDT, Tim Cuthbertson
no flags Details
build if_python.o with -O0 (1.13 KB, patch)
2012-08-10 18:34 EDT, Aron Griffis
no flags Details | Diff
Patch vim.spec to include vim-7.3-py_ssize_t.patch (1.17 KB, patch)
2012-08-31 09:42 EDT, Aron Griffis
no flags Details | Diff
vim-7.3-py_ssize_t.patch (1.13 KB, patch)
2012-08-31 09:43 EDT, Aron Griffis
no flags Details | Diff

  None (edit)
Description Tim Cuthbertson 2012-04-27 21:43:15 EDT
Created attachment 580900 [details]
backtrace from dumped core (using gdb)

Description of problem:

Running any python commands within vim causes a segfault

Version-Release number of selected component (if applicable):

$ sudo yum info vim-X11    
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks, presto, refresh-packagekit
Installed Packages
Name        : vim-X11
Arch        : x86_64
Epoch       : 2
Version     : 7.3.444
Release     : 1.fc17
Size        : 2.3 M
Repo        : installed
From repo   : fedora
Summary     : The VIM version of the vi editor for the X Window System
URL         : http://www.vim.org/
License     : Vim


How reproducible:

always

Steps to Reproduce:
1. run gvim
2. type ":python print 1"
  
Actual results:

vim segfaults

Additional info:
I get the same results with vim-enhanced-7.3.444-1.fc17.x86_64 (running vim instead of gvim).
Comment 1 gostrc 2012-04-29 23:38:02 EDT
I'm almost certain this is the same bug as:
http://thread.gmane.org/gmane.editors.vim.devel/34092

The fix under arch so far has been to remove -O2 from the CFLAGS.

I'm guessing this is gcc 4.7 related, but I still don't know the underlying problem :/
Comment 2 Shane Davies 2012-05-02 13:43:41 EDT
It may be a result of:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53084

As the discussion on the vim_dev forum suggests:
https://groups.google.com/group/vim_dev/browse_thread/thread/c812f81a419551d3?pli=1
Comment 3 gostrc 2012-05-02 15:02:49 EDT
Note that http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53084
was also in the 4.6 branch which makes this bug unlikely since the previous vim compiled with 4.6 didn't seem to have this bug.
Comment 4 Aron Griffis 2012-05-15 09:49:27 EDT
The conversation on vim-dev has progressed and it sounds like Debian has an updated gcc which might help: https://groups.google.com/d/msg/vim_dev/yBL4GkGVUdM/l5fSHMG2dWcJ
Comment 5 Aron Griffis 2012-05-15 09:59:37 EDT
(In reply to comment #4)
> The conversation on vim-dev has progressed and it sounds like Debian has an
> updated gcc which might help:
> https://groups.google.com/d/msg/vim_dev/yBL4GkGVUdM/l5fSHMG2dWcJ

In fact this gcc fix is already in F17 so maybe rebuilding vim would do the trick. I'm running the same version as the OP so it hasn't been rebuilt since the gcc update. (I'm trying to rebuild locally but running into protected multilib versions installing dependencies; looks like the i686 and x86_64 repos are out of sync at the moment.)
Comment 6 Karsten Hopp 2012-05-15 10:27:45 EDT
have you tried vim-7.3.515-1.fc17 from updates-testing ?
Comment 7 Shane Davies 2012-05-15 14:40:40 EDT
vim-7.3.515-1.fc17 from updates-testing prevents vim from segfaulting.

It does not seem to fix this issue.
Printing to the output buffer will return null.

As the following commit log suggests:
http://code.google.com/p/vim/source/detail?r=e34c620007be9fd805556c43fe848de521f3b64c
Comment 8 Aron Griffis 2012-05-15 15:37:17 EDT
(In reply to comment #6)
> have you tried vim-7.3.515-1.fc17 from updates-testing ?

Thanks, vim no longer segfaults with this version. I had inadvertently disabled updates-testing previously.

(In reply to comment #7)
> vim-7.3.515-1.fc17 from updates-testing prevents vim from segfaulting.
> 
> It does not seem to fix this issue.
> Printing to the output buffer will return null.
> 
> As the following commit log suggests:
> http://code.google.com/p/vim/source/detail?r=e34c620007be9fd805556c43fe848de521f3b64c

Yeah, for example ":python raise Exception" on F16 displays the exception, but on F17 with vim-7.3.515-1.fc17 it's just silent. Not sure if this deserves a separate ticket or if it's okay to keep using this one.
Comment 9 Aron Griffis 2012-05-15 15:39:34 EDT
I wonder if it would work to build vim-7.3.515-1.fc17 omitting patch 497 (the workaround) using gcc-4.7.0-5.fc17.x86_64 (theoretically has the fix, according to Debian folks)
Comment 10 gostrc 2012-05-15 18:17:41 EDT
Just an fyi, archlinux using the gcc snapshot 4.7-20120505 still encounters this problem.
Comment 11 Aron Griffis 2012-05-16 11:51:55 EDT
(In reply to comment #9)
> I wonder if it would work to build vim-7.3.515-1.fc17 omitting patch 497 (the
> workaround) using gcc-4.7.0-5.fc17.x86_64 (theoretically has the fix, according
> to Debian folks)

I rebuilt vim-7.3.444-1.fc17 using gcc-4.7.0-5.fc17.x86_64 and got the segfault, so it seems like the supposed gcc fix doesn't help.
Comment 12 Meir Kriheli 2012-06-25 08:50:07 EDT
While it won't segfault, python functioanllty is disabled ( :python print "hello" does nothing), as a result many of rope-vim functionality is disabled.

Any updates regarding this ?
Comment 13 Aron Griffis 2012-08-10 18:31:52 EDT
This problem persists in vim-7.3.622-2.fc18.  It's no longer a segfault since that was fixed by patch 497, but it's still a pain because python print and exceptions no longer generate output.

I'll attach a patch that works around the problem by building if_python.o (and only that) with -O0. Since this has been broken for a few months and there's progress on vim-dev, would you consider including this workaround for now?
Comment 14 Aron Griffis 2012-08-10 18:34:12 EDT
Created attachment 603642 [details]
build if_python.o with -O0
Comment 15 Meir Kriheli 2012-08-12 20:16:10 EDT
I've used the diff and rebuilt the packages, python with vim works again now.

+1 for including it (at least some better solution will surface).

Thanks Aron.
Comment 16 Fedora Update System 2012-08-28 10:15:34 EDT
vim-7.3.638-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/vim-7.3.638-2.fc17
Comment 17 Fedora Update System 2012-08-28 19:25:09 EDT
Package vim-7.3.638-2.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing vim-7.3.638-2.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-12869/vim-7.3.638-2.fc17
then log in and leave karma (feedback).
Comment 18 Tim Cuthbertson 2012-08-29 07:34:57 EDT
After testing this version there is no segfault, but that was already the case due to the workaround. Since printing from python still doesn't work, I think we'd need to revert the workaround (from http://code.google.com/p/vim/source/detail?r=e34c620007be9fd805556c43fe848de521f3b64c) in order to see if this is really fixed.
Comment 19 Aron Griffis 2012-08-31 09:30:11 EDT
Why is this bug marked ON_QA? vim-7.3.638-2.fc17 doesn't fix the problem. The segfault is avoided but that was already the case. It's just a symptom (albeit a nasty one) of the underlying issue.

Rather than the workaround I posted in comment 14, here's the proper fix: https://groups.google.com/forum/?fromgroups=#!topic/vim_dev/zxXc0aGhaKM
Comment 20 Aron Griffis 2012-08-31 09:42:25 EDT
Created attachment 608523 [details]
Patch vim.spec to include vim-7.3-py_ssize_t.patch
Comment 21 Aron Griffis 2012-08-31 09:43:16 EDT
Created attachment 608524 [details]
vim-7.3-py_ssize_t.patch
Comment 22 Fedora Update System 2012-08-31 17:23:19 EDT
vim-7.3.638-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 23 Aron Griffis 2012-09-01 08:24:48 EDT
Hey Karsten, this bug is CLOSED ERRATA but I don't think it should be. I attached a patch above that fixes the real issue. Would you consider reopening this bug and applying the patch?
Comment 24 Meir Kriheli 2012-09-02 04:06:24 EDT
+1 For Aron, please reopen and use the upstream patch which Aron pointed to at comment 19.
Comment 25 Karsten Hopp 2012-09-05 11:47:58 EDT
Upstream released patch 7.3.652 which should fix the python issue. I'll prepare updated packages soon.

Patch 7.3.652
Problem:    Workaround for Python crash isn't perfect.
Solution:   Change the type of the length argument. (Sean Estabrooks)
Files:	    src/if_py_both.h
Comment 26 Meir Kriheli 2012-10-05 20:16:47 EDT
Hi, any updates on that ?

Thanks
Comment 27 gostrc 2012-10-05 22:00:43 EDT
On archlinux, latest vim doesn't have this problem anymore
Comment 28 Meir Kriheli 2012-10-08 05:08:53 EDT
I meant package wise.
Comment 29 Meir Kriheli 2012-10-30 19:27:55 EDT
Sorry, missed the updated packages (got using to deselecting vim related stuff).

Seems great now. IMO this can be closed.
Comment 30 Tim Cuthbertson 2012-10-31 06:23:07 EDT
Yup, agreed - I no longer have the issue, and printing works from python. Hopefully "upstream" is the right close reason?

Note You need to log in before you can comment on or make changes to this bug.