You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 226 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
SIGINT
let h = match x with Sys.Signal_handle f -> f;;
Characters 8-45:
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(Signal_default|Signal_ignore)
val h : int -> unit =
h 4;;
SIGINT
: unit = ()
The expected behaviour is that h 4 raises Sys.Break.
In byterun/signals.c, function install_signal_handlers, the record
signal_handlers
is modified before the sigaction syscall is performed, and so the lines
if (oldact == handle_signal) {
res = alloc_small (1, 0); /* Signal_handle */
Field(res, 0) = Field(signal_handlers, sig);
}
will put the closure of the new handler into res. I think the bugfix is
trivial; signal_handlers should be modified after res has been set to the value
of the old handler.
Gerd
The text was updated successfully, but these errors were encountered:
Original bug ID: 226
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Gerd Stolpmann
Version: 3.00
OS: Linux
Submission from: drms-3e364ae6.pool.mediaways.net (62.54.74.230)
Hello Caml'ers,
I recently found the following incorrect behaviour in O'Caml-3.00.
Sys.signal does not return the previous handler, but the new one:
let x = Sys.signal
val x : Sys.signal_behavior = Sys.Signal_handle
[pressing CTRL-C]
SIGINT
let h = match x with Sys.Signal_handle f -> f;;
Characters 8-45:
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(Signal_default|Signal_ignore)
val h : int -> unit =
h 4;;
SIGINT
The expected behaviour is that h 4 raises Sys.Break.
In byterun/signals.c, function install_signal_handlers, the record
signal_handlers
is modified before the sigaction syscall is performed, and so the lines
if (oldact == handle_signal) {
res = alloc_small (1, 0); /* Signal_handle */
Field(res, 0) = Field(signal_handlers, sig);
}
will put the closure of the new handler into res. I think the bugfix is
trivial; signal_handlers should be modified after res has been set to the value
of the old handler.
Gerd
The text was updated successfully, but these errors were encountered: