Project

General

Profile

Bug #9878

ruby_signal() should return either sa_sigaction or sa_handler, depending on SA_SIGINFO

Added by ReiOdaira (Rei Odaira) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-05-29 trunk 46222) [x86_64-linux]
[ruby-core:62836]

Description

ruby_signal() in signal.c returns old.sa_handler,
but it should return either old.sa_sigaction or old.sa_handler,
depending on whether SA_SIGINFO is set in old.sa_flags.

--- signal.c    (revision 46222)
+++ signal.c    (working copy)
@@ -595,7 +595,10 @@
            rb_bug_errno("sigaction", errno);
        }
     }
-    return old.sa_handler;
+    if (old.sa_flags & SA_SIGINFO)
+       return (sighandler_t)old.sa_sigaction;
+    else
+       return old.sa_handler;
 }

 sighandler_t

The original code happens to be correct on the environments
where sa_handler and sa_sigaction are union, but it is not
guaranteed in general.

(Actually, they are not union on z/OS.)

Associated revisions

Revision fad56622
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 46233
Added by nobu (Nobuyoshi Nakada) almost 5 years ago

signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Revision 6491028d
Added by usa (Usaku NAKAMURA) almost 5 years ago

merge revision(s) 46233: [Backport #9878]

* signal.c (ruby_signal): should return either `old.sa_sigaction`
  or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
  `old.sa_flags`, because they may not be a union.
  [ruby-core:62836] [Bug #9878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46583
Added by usa (Usaku NAKAMURA) almost 5 years ago

merge revision(s) 46233: [Backport #9878]

* signal.c (ruby_signal): should return either `old.sa_sigaction`
  or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
  `old.sa_flags`, because they may not be a union.
  [ruby-core:62836] [Bug #9878]

Revision d681d9ce
Added by nagachika (Tomoyuki Chikanaga) almost 5 years ago

merge revision(s) r46233: [Backport #9878]

* signal.c (ruby_signal): should return either `old.sa_sigaction`
  or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
  `old.sa_flags`, because they may not be a union.
  [ruby-core:62836] [Bug #9878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 46616
Added by nagachika (Tomoyuki Chikanaga) almost 5 years ago

merge revision(s) r46233: [Backport #9878]

* signal.c (ruby_signal): should return either `old.sa_sigaction`
  or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
  `old.sa_flags`, because they may not be a union.
  [ruby-core:62836] [Bug #9878]

History

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46233.


signal.c: return proper member

  • signal.c (ruby_signal): should return either old.sa_sigaction or old.sa_handler, depending on whether SA_SIGINFO is set in old.sa_flags, because they may not be a union. [ruby-core:62836] [Bug #9878]

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

Updated by usa (Usaku NAKAMURA) almost 5 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: DONE, 2.1: REQUIRED

backported into ruby_2_0_0 at r46583.

Updated by nagachika (Tomoyuki Chikanaga) almost 5 years ago

  • Backport changed from 2.0.0: DONE, 2.1: REQUIRED to 2.0.0: DONE, 2.1: DONE

Backported into ruby_2_1 at r46616.

Also available in: Atom PDF