[#11073] segfault printing instruction sequence for iterator — <noreply@...>

Bugs item #10527, was opened at 2007-05-02 14:42

14 messages 2007/05/02
[#11142] Re: [ ruby-Bugs-10527 ] segfault printing instruction sequence for iterator — Nobuyoshi Nakada <nobu@...> 2007/05/10

Hi,

[#11188] Re: [ ruby-Bugs-10527 ] segfault printing instruction sequence for iterator — Paul Brannan <pbrannan@...> 2007/05/16

On Thu, May 10, 2007 at 04:51:18PM +0900, Nobuyoshi Nakada wrote:

[#11234] Planning to release 1.8.6 errata — Urabe Shyouhei <shyouhei@...>

Hi all.

17 messages 2007/05/25

Re: [ ruby-Bugs-11151 ] exception in at_exit --> 0 exit status

From: Nobuyoshi Nakada <nobu@...>
Date: 2007-05-27 14:36:11 UTC
List: ruby-core #11268
Hi,

> At Sun, 27 May 2007 08:19:53 +0900,
> Johan Holmberg wrote in [ruby-core:11263]:
> > If an exception occurs in an at_exit block, the Ruby process
> > still exits with a zero exit status. This seems
> > wrong. Example code:
> > 
> >   $ ruby -e 'at_exit { raise "an error" }' ; echo $?
> >   -e:1: an error (RuntimeError)
> >           from -e:1
> >   0
> > 
> > All Ruby version I have tested work this way:
> 
> I'm not sure if this is a bug or a feature.

Sorry, exit code by SystemExit should not be altered.


Index: eval.c
===================================================================
--- eval.c	(revision 12393)
+++ eval.c	(working copy)
@@ -193,4 +193,16 @@ ruby_cleanup(int ex)
 	    ruby_default_signal(NUM2INT(sig));
 	}
+	else if (ex == 0) {
+	    ex = 1;
+	}
+    }
+
+    switch (ex) {
+#if EXIT_SUCCESS != 0
+      case 0: return EXIT_SUCCESS;
+#endif
+#if EXIT_FAILURE != 1
+      case 1: return EXIT_FAILURE;
+#endif
     }
 


-- 
Nobu Nakada

In This Thread

Prev Next