summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Brown <rbrown@gentoo.org>2007-04-28 11:06:29 +0000
committerRichard Brown <rbrown@gentoo.org>2007-04-28 11:06:29 +0000
commit8fe11788cbd8f7dffb6988b3b419141a052d45bd (patch)
treed06eab2ab94bacba2a6e18eeac84517dccde9733
parentadd ruby-odbc (diff)
downloadrbrown-8fe11788cbd8f7dffb6988b3b419141a052d45bd.tar.gz
rbrown-8fe11788cbd8f7dffb6988b3b419141a052d45bd.tar.bz2
rbrown-8fe11788cbd8f7dffb6988b3b419141a052d45bd.zip
Fix ruby exit status
svn path=/; revision=14
-rw-r--r--dev-lang/ruby/files/ruby-1.8.6-exit-status.patch80
-rw-r--r--dev-lang/ruby/ruby-1.8.6-r2.ebuild (renamed from dev-lang/ruby/ruby-1.8.6-r1.ebuild)2
2 files changed, 82 insertions, 0 deletions
diff --git a/dev-lang/ruby/files/ruby-1.8.6-exit-status.patch b/dev-lang/ruby/files/ruby-1.8.6-exit-status.patch
new file mode 100644
index 0000000..a86587f
--- /dev/null
+++ b/dev-lang/ruby/files/ruby-1.8.6-exit-status.patch
@@ -0,0 +1,80 @@
+Index: test/ruby/test_beginendblock.rb
+===================================================================
+--- test/ruby/test_beginendblock.rb (revision 12125)
++++ test/ruby/test_beginendblock.rb (revision 12126)
+@@ -54,4 +54,34 @@
+ assert_equal(expected, File.read(erroutpath))
+ # expecting Tempfile to unlink launcher and errout file.
+ end
++
++ def test_raise_in_at_exit
++ # [ruby-core:09675]
++ ruby = EnvUtil.rubybin
++ out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
++ "at_exit{raise %[SomethingBad]};" \
++ "raise %[SomethingElse]'") {|f|
++ f.read
++ }
++ assert_match /SomethingBad/, out
++ assert_match /SomethingElse/, out
++ end
++
++ def test_should_propagate_exit_code
++ ruby = EnvUtil.rubybin
++ assert_equal false, system("#{q(ruby)} -e 'at_exit{exit 2}'")
++ assert_equal 2, $?.exitstatus
++ assert_nil $?.termsig
++ end
++
++ def test_should_propagate_signaled
++ ruby = EnvUtil.rubybin
++ out = IO.popen("#{q(ruby)} -e 'STDERR.reopen(STDOUT);" \
++ "at_exit{Process.kill(:INT, $$)}'"){|f|
++ f.read
++ }
++ assert_match /Interrupt$/, out
++ assert_nil $?.exitstatus
++ assert_equal Signal.list["INT"], $?.termsig
++ end
+ end
+Index: eval.c
+===================================================================
+--- eval.c (revision 12125)
++++ eval.c (revision 12126)
+@@ -1562,11 +1562,15 @@
+ int ex;
+ {
+ int state;
+- volatile VALUE err = ruby_errinfo;
++ VALUE err;
++ volatile VALUE errs[2];
++ int nerr;
+
++ errs[0] = ruby_errinfo;
+ ruby_safe_level = 0;
+ Init_stack((void*)&state);
+ ruby_finalize_0();
++ errs[1] = ruby_errinfo;
+ PUSH_TAG(PROT_NONE);
+ PUSH_ITER(ITER_NOT);
+ if ((state = EXEC_TAG()) == 0) {
+@@ -1577,15 +1581,15 @@
+ ex = state;
+ }
+ POP_ITER();
+- ruby_errinfo = err;
++ ruby_errinfo = errs[0];
+ ex = error_handle(ex);
+ ruby_finalize_1();
+ POP_TAG();
+
+- if (err) {
++ for (nerr = sizeof(errs) / sizeof(errs[0]); nerr;) {
++ if (!(err = errs[--nerr])) continue;
+ if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
+- VALUE st = rb_iv_get(err, "status");
+- return NUM2INT(st);
++ return sysexit_status(err);
+ }
+ else if (rb_obj_is_kind_of(err, rb_eSignal)) {
+ VALUE sig = rb_iv_get(err, "signo");
diff --git a/dev-lang/ruby/ruby-1.8.6-r1.ebuild b/dev-lang/ruby/ruby-1.8.6-r2.ebuild
index 7d1b44e..29135ea 100644
--- a/dev-lang/ruby/ruby-1.8.6-r1.ebuild
+++ b/dev-lang/ruby/ruby-1.8.6-r2.ebuild
@@ -53,6 +53,8 @@ src_unpack() {
configure.in || die "sed failed"
eautoreconf
+
+ epatch ${FILESDIR}/${P}-exit-status.patch
}
src_compile() {