Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006401OCamlOCaml tools (ocaml{lex,yacc,dep,browser,debug})public2014-05-07 10:392015-12-02 17:00
Assigned Tofrisch 
PlatformOSOS Version
Product Version 
Target Version4.03.0+devFixed in Version4.03.0+dev 
Summary0006401: [patch] use proper error reporting for toplevel's environment initialization
DescriptionWhen hacking on the compiler itself, a classic failure when running the toplevel is that it tries to link against the installed standard library instead of the one being modified, which gives various interface mismatches -- the fix is to pass "-I stdlib -nostdlib", and I also need "-noinit" for other reasons.

On trunk, the reporting is currently not very nice (there might be a regression from older versions):

> % ./byterun/ocamlrun ./ocaml
> OCaml version 4.02.0+dev5-2014-04-29
> Fatal error: exception Env.Error(_)

The attached patch calls the error-reporting routines to print a better error message:

> % ./byterun/ocamlrun ./ocaml
> OCaml version 4.02.0+dev5-2014-04-29
> File "_none_", line 1:
> Error: The files ./ocaml
> and /home/gabriel/.opam/4.02.0local+git-trunk/lib/ocaml/pervasives.cmi
> make inconsistent assumptions over interface Pervasives
Additional InformationThe patch is careful to only catch Env.Error exceptions, so as not to trash the backtraces of other, unplanned-for failures. After catching and reporting the exception, it terminates with "exit 2":
- keeping an uninitialized toplevel alive makes no sense
- re-raising the exception seems useless (the backtrace is trashed) and potentially confusing
- "2" was already used as an error code in
Attached Filespatch file icon toplevel-initialization-error-reporting.patch [^] (1,746 bytes) 2014-05-07 10:39 [Show Content]

- Relationships

-  Notes
johnwhitington (reporter)
2014-05-07 14:04
edited on: 2014-05-07 14:04

Excellent. I knew I must have been missing something simple, but no-one seemed to know! [^]

frisch (developer)
2015-12-02 17:00

I've merged the patch to trunk, also capturing Typetexp.Error. This allows to get:

$ boot/ocamlrun ./ocaml
        OCaml version 4.03.0+dev11-2015-10-19

File "command line", line 1:
Error: Unbound module Pervasives

- Issue History
Date Modified Username Field Change
2014-05-07 10:39 gasche New Issue
2014-05-07 10:39 gasche File Added: toplevel-initialization-error-reporting.patch
2014-05-07 14:04 johnwhitington Note Added: 0011382
2014-05-07 14:04 johnwhitington Note Edited: 0011382 View Revisions
2014-06-02 20:30 doligez Tag Attached: patch
2014-06-02 20:33 doligez Severity tweak => feature
2014-06-02 20:33 doligez Status new => confirmed
2014-06-02 20:33 doligez Target Version => 4.03.0+dev
2015-12-02 17:00 frisch Note Added: 0014966
2015-12-02 17:00 frisch Status confirmed => resolved
2015-12-02 17:00 frisch Fixed in Version => 4.03.0+dev
2015-12-02 17:00 frisch Resolution open => fixed
2015-12-02 17:00 frisch Assigned To => frisch

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker