A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ocaml/ocaml/issues/12898 below:

Regression on Out_channel exceptions · Issue #12898 · ocaml/ocaml · GitHub

As part of revising our Out_channel multicoretests I discovered the following regression.
Consider the following program writing to a closed channel twice:

let path = "/tmp/foo.txt" in
let oc = Out_channel.open_text path in
let () = Out_channel.close oc in
let () =
  try Out_channel.output_char oc '1'; Printf.printf " 1 OK%!"
  with Sys_error _ -> Printf.printf " 1 Sys_error%!" in
let () =
  try Out_channel.output_char oc '2'; Printf.printf " 2 OK%!"
  with Sys_error _ -> Printf.printf " 2 Sys_error%!" in
()

On 4.14.1, 5.0.0, 5.1.0, 5.1.1 this behaves the same, yielding an exception in both cases:

$ ocaml /tmp/ocbug.ml 
 1 Sys_error 2 Sys_error

However, on 5.2 and on trunk/5.3 this no longer raises an exception in the second case.

$ ocaml /tmp/ocbug.ml 
 1 Sys_error 2 OK

The issue is not limited to output_char. The other output operations output_byte, output_string, ... are also affected.

Looking at changes in runtime/io.c I've established that the behaviour changed with #12314.
A compiler built from the previous commit to trunk / 5.2 exhibits the previous behaviour:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4