utop icon indicating copy to clipboard operation
utop copied to clipboard

UTop crashes on closing comment if comment wasn't opened

Open obadz opened this issue 11 years ago • 9 comments

$ utop -version The universal toplevel for OCaml, version 1.14, compiled for OCaml version 4.01.0

utop # *)Fatal error: exception (Invalid_argument "index out of bounds") Raised at file "format.ml", line 195, characters 41-52 Called from file "format.ml", line 423, characters 8-33 Called from file "format.ml", line 438, characters 6-24

obadz avatar Aug 31 '14 12:08 obadz

I can't reproduce this, does it crash when you type exactly *)?

ghost avatar Sep 01 '14 10:09 ghost

Yes (sorry for the delayed response). I invoke utop, keypress '*', keypress ')', keypress enter => crash.

obadz avatar Sep 15 '14 07:09 obadz

I should probably specify: I'm using Ubuntu 14.04 / Linux 3.16.1-031601-generic

obadz avatar Sep 15 '14 07:09 obadz

Do you have an ~/.ocamlinit?

ghost avatar Sep 15 '14 12:09 ghost

Yes. Contains this:


(* Added by OPAM. *)
let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()
;;

#use "topfind"
#require "core"

(* open Core.Std *)

obadz avatar Sep 15 '14 19:09 obadz

Removing it or putting an invalid expression in it seems to fix the problem, but I'm not sure what's wrong with my ocamlinit?

obadz avatar Sep 15 '14 19:09 obadz

I haven't tested this, but could it be the lack of ;; after each #require line?

hcarty avatar Sep 16 '14 03:09 hcarty

Adding ;; after requires doesn't seem to change the issue.

obadz avatar Sep 16 '14 07:09 obadz

The crash happens when my .ocamlinit contains the single line below:

#require "core" ;;

obadz avatar Sep 16 '14 07:09 obadz