-
-
Couldn't load subscription status.
- Fork 5.9k
Avoid rb_load_protect as a workaround not to crash
#2147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2147 +/- ##
==========================================
+ Coverage 73.96% 73.98% +0.01%
==========================================
Files 90 90
Lines 131906 131908 +2
Branches 28964 28965 +1
==========================================
+ Hits 97570 97592 +22
+ Misses 34313 34297 -16
+ Partials 23 19 -4
Continue to review full report at Codecov.
|
|
This issue is fixed by ruby/ruby@d352d0a, and will be backported on next 2.3/2.4 stable release. |
|
This works for static linking, but not when using ruby/dynamic |
|
Stack trace when Vim crashes: that is at this command: |
|
I'd like to definitely decline the proposal of co-authorship. If things should be settled like that, that is, through my accepting co-authorship, then that must sound as if I stole this PR, smuggled it into master via my own PR #2178, and approved such an terrible allegation against me afterwards. As clearly shown in the commit log of #2178, I'm not guilty. Accordingly, there's no reason at all for me to accept such a ridiculous proposal. How can I be in favor of the patch of this PR at the cost of my honor? No way. Furthermore, the proposed patch of this PR has already been labeled "incomplete" via a message to vim_dev. I'm wondering how come it's possible for someone to think the inclusion intended. I would say that must have took place accidentally. Naturally, a decent solution to that is crystal clear to everyone: Remove that Ruby part from 8.0.1236 and make the latter clean. |
|
I agree that this PR is totally unrelated to #2178, so adding his name to 8.0.1236 is confusing and/or misleading.
Of course I know. So I'm asking to Bram, not to you. |
|
Comparing the current Seems like there's been another patch different from this PR's. I'm wondering how the former is related to the latter in terms of authorship, though I actually don't care about that. |
|
We understand and strongly believe this is simply mistake of commit. And we are thinking contributor's name should be credited in the the patch files. For the contributors, what their name is credited in the patch file is proud things for themselves. :) |
|
I am sorry, I did not follow the whole conversation. Is there anything to be done here? |
|
It's all up to Bram. Possible choices might be:
|
|
Ken Takata wrote:
@brammool It looks that this is merged as a part of [8.0.1236](d057301).
Is this intended? If so, we can close this PR, and I think @ujihisa's name should be credited in the patch (when you update version8.txt).
That was by accident. That change was pending, since the test still
fails. So not the test part is still pending:
*** ../vim-8.0.1241/src/testdir/test_ruby.vim 2017-01-29 23:11:21.172512839 +0100
--- src/testdir/test_ruby.vim 2017-10-21 19:17:06.040153912 +0200
***************
*** 49,51 ****
--- 49,59 ----
bwipe!
bwipe!
endfunc
+
+ func Test_rubyfile()
+ " Check :rubyfile does not SEGV with Ruby level exception but just fails
+ let tempfile = tempname() . '.rb'
+ call writefile(['raise "vim!"'], tempfile)
+ call assert_fails('rubyfile ' . tempfile)
+ call delete(tempfile)
+ endfunc
…--
[Another hideous roar.]
BEDEVERE: That's it!
ARTHUR: What?
BEDEVERE: It's The Legendary Black Beast of Aaaaarrrrrrggghhh!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 ///
|
|
Ken Takata wrote:
It's all up to Bram. Possible choices might be:
* If Bram didn't intend to include the change to if_ruby.c:
Create a new commit to revert the change and,
* Create a new patch file (on the ftp server), or
* Modify the patch 8.0.1236 and remove the change from it.
* If the change is intended, make the change clearer and give a proper credit:
* For the patch files:
* Modify the patch 8.0.1236 and move the change into a new patch, or
* Keep 8.0.1236 as it is, create a new patch to revert the change, and create another patch to include the change again.
* For the git repository:
* Keep as it is, or
* Create a new commit to revert the change, and create another commit to include the change again.
The problem with git (or any version control system) is that it doesn't
allow for rewriting history. If I was sending out patches only, I could
edit that patch and correct the mistake. But now that's impossible.
I'll add a note in the patch message:
Solution: Make feature names more consistent, add "osxdarwin". Rename
feature flags, cleanup Mac code. (Kazunobu Kuriyama, closes #2178)
Also includes a fix for when Ruby throws an exception inside
:rubyfile.(ujihisa)
…--
Dreams are free, but there's a small charge for alterations.
/// Bram Moolenaar -- [email protected] -- 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 ///
|
|
Thanks for Bram to merge, and nurse, k-takata, and mattn for catching that up. As Bram mentioned that I confirmed that it still crashes with # sorry for extremely late reply. I was focusing on VimConf last month and I forgot replying at all.. |
|
Thanks a lot! |
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Problem: Segmentation fault when Ruby throws an exception inside :rubyfile
command.
Solution: Use rb_protect() instead of rb_load_protect(). (ujihisa,
closes vim/vim#2147, greywolf, closes vim/vim#2512, vim/vim#2511)
vim/vim@37badc8
Short summary: fix a segv for if_ruby.
Problem
Vim with
+rubycauses segmentation fault when Ruby throws an exception inside:rubyfilecommand.I tested with Vim 7.3.939, 8.0.0000, latest 8.0.1139, with Ruby 2.3.1, 2.4.2, and latest 2.5.0dev. I don't know when exactly happened, but it must have been happening since pretty old version.
This is likely a Ruby bug, since
rb_load_protectis supposed to be used to avoid segmentation fault, according to a third-party doc.a Ruby committer also suggested it may be a Ruby bug.Solution
I took a workaround. According to existing
:h rubyfile, the updated behaviour should be straightforward.For long-term solution, Ruby should fix the function itself. Vim supports older versions of Ruby, so the above solution should be better.
Acknowledgement
Thanks @pocke to report this issue at vim-jp/issues#1098, and @mattn to help me a lot contributing to vim core for the first time! Also thanks indirectly to @nurse confirming it's likely a Ruby bug.