utop icon indicating copy to clipboard operation
utop copied to clipboard

Utop in Emacs under Windows crashes when UTop is mistyped as Utop

Open ysalmon opened this issue 2 years ago • 2 comments

I am fumbling with Emacs+Utop+company under Windows, and I may have stumbled into some bug.

At the prompt from utop mode in Emacs, if I type Utop (instead of UTop), then a dot, the text cursor stops blinking, and if I type another character, utop crashes with code 2 after a Fatal error: exception Persistent_env.Error(_).

This happens too if I do the same kind of case-mistyping with modules not from the stdlib (eg. GRaphics), but not with eG. ARRay.

I also could not reproduce the behaviour under Linux.

I believe this to be related to filenames being case insensitive under windows : when one case-mistypes the module name, one still gets to the corresponding .cmi file, but the module name is wrong and this is not properly handled.

This is corroborated by the following : running utop directly in a cygwin terminal, typing Utop.version;; gives

Error: Wrong file naming: C:\OCaml64\home\yann\.opam\4.14.0+mingw64\lib\utop\utop.cmi
       contains the compiled interface for UTop when Utop was expected

although the file is actually named uTop.cmi.

Doing the same under linux gives Error: Unbound module Utop.

EDIT : this might be an OCaml bug or deficiency, in fact.

ysalmon avatar Jan 23 '23 20:01 ysalmon

There was an OCaml PR to perform case-sensitive search for cmi files, but it was not merged.

ysalmon avatar Jan 23 '23 20:01 ysalmon

Hi, To determine if this is an issue with utop or the ocaml toplevel, can you try to reproduce it with the vanilla toplevel? ie

% ocaml
#use "topfind";;
#require "graphics";;
#show_module GRaphics;;

Or something like that.

emillon avatar Feb 22 '23 10:02 emillon