Bug 817196

Summary: Running :python commands in vim causes a segfault
Product: [Fedora] Fedora Reporter: Tim Cuthbertson <tim>
Component: vimAssignee: Karsten Hopp <karsten>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: aron, gostrc, karsten, lmacken, mkriheli, shane
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-31 10:23:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
backtrace from dumped core (using gdb)
none
build if_python.o with -O0
none
Patch vim.spec to include vim-7.3-py_ssize_t.patch
none
vim-7.3-py_ssize_t.patch none

Description Tim Cuthbertson 2012-04-28 01:43:15 UTC
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-30 03:38:02 UTC
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 17:43:41 UTC
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 19:02:49 UTC
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 13:49:27 UTC
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 13:59:37 UTC
(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 14:27:45 UTC
have you tried vim-7.3.515-1.fc17 from updates-testing ?

Comment 7 Shane Davies 2012-05-15 18:40:40 UTC
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 19:37:17 UTC
(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 19:39:34 UTC
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 22:17:41 UTC
Just an fyi, archlinux using the gcc snapshot 4.7-20120505 still encounters this problem.

Comment 11 Aron Griffis 2012-05-16 15:51:55 UTC
(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 12:50:07 UTC
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 22:31:52 UTC
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 22:34:12 UTC
Created attachment 603642 [details]
build if_python.o with -O0

Comment 15 Meir Kriheli 2012-08-13 00:16:10 UTC
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 14:15:34 UTC
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 23:25:09 UTC
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 11:34:57 UTC
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 13:30:11 UTC
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 13:42:25 UTC
Created attachment 608523 [details]
Patch vim.spec to include vim-7.3-py_ssize_t.patch

Comment 21 Aron Griffis 2012-08-31 13:43:16 UTC
Created attachment 608524 [details]
vim-7.3-py_ssize_t.patch

Comment 22 Fedora Update System 2012-08-31 21:23:19 UTC
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 12:24:48 UTC
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 08:06:24 UTC
+1 For Aron, please reopen and use the upstream patch which Aron pointed to at comment 19.

Comment 25 Karsten Hopp 2012-09-05 15:47:58 UTC
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-06 00:16:47 UTC
Hi, any updates on that ?

Thanks

Comment 27 gostrc 2012-10-06 02:00:43 UTC
On archlinux, latest vim doesn't have this problem anymore

Comment 28 Meir Kriheli 2012-10-08 09:08:53 UTC
I meant package wise.

Comment 29 Meir Kriheli 2012-10-30 23:27:55 UTC
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 10:23:07 UTC
Yup, agreed - I no longer have the issue, and printing works from python. Hopefully "upstream" is the right close reason?