Skip to content
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

bad signal number in signal handler #2797

Closed
vicuna opened this issue Jun 19, 2001 · 2 comments
Closed

bad signal number in signal handler #2797

vicuna opened this issue Jun 19, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 19, 2001

Original bug ID: 395
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Raoul Bhoedjang
Version: ocaml 3.01
OS: linux 2.4.2-2
Submission from: syr-66-24-49-102.twcny.rr.com (66.24.49.102)

Problem: When compiled with ocamlopt, signal handlers receive a bad
signal-number argument. The problem does not occur when the same
code is compiled with ocamlc.

Probable cause: in asmrun/signals.c, in execute_signal, the Unix signal
number is not converted back to an Ocaml signal number. In
byterun/signals.c, a reverse conversion takes place that is
absent in asmrun/signals.c.

Example:

open Printf
open Unix

let do_tick signum =
if signum <> Sys.sigalrm then begin
eprintf "BUG: signum = %d, sigalrm = %d\n" signum Sys.sigalrm;
exit 8
end

let main () =
Sys.set_signal Sys.sigalrm (Sys.Signal_handle do_tick);
while true do
prerr_endline "hi";
kill (getpid ()) Sys.sigalrm
done

;;
main ()

@vicuna
Copy link
Author

vicuna commented Jun 19, 2001

Comment author: administrator

Problem: When compiled with ocamlopt, signal handlers receive a bad
signal-number argument. The problem does not occur when the same
code is compiled with ocamlc.

Probable cause: in asmrun/signals.c, in execute_signal, the Unix signal
number is not converted back to an Ocaml signal number. In
byterun/signals.c, a reverse conversion takes place that is
absent in asmrun/signals.c.

Correct. This issue (and another signal-related bug) was fixed in the
bytecode runtime, but not in the asm runtime. This is now fixed in
the working sources. Thanks for reporting it.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jun 19, 2001

Comment author: administrator

Fixed 2001-06-19 by Xavier.

@vicuna vicuna closed this as completed Jun 19, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant