Opened 3 years ago

Closed 2 years ago

#10101 closed bug (fixed)

ghci :e throws exception after type error

Reported by: diatchki Owned by: archblob
Priority: normal Milestone: 7.10.2
Component: GHCi Version: 7.10.1-rc2
Keywords: Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D930
Wiki Page:

Description

After a type-error on the command line, :e starts throwing an exception. To reproduce:

~/src/ghc/inplace/bin/ghc-stage2 --interactive test.hs

GHCi, version 7.11.20150128: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> 1 + ()

<interactive>:2:3:
    No instance for (Num ()) arising from a use of ‘+’
    In the expression: 1 + ()
    In an equation for ‘it’: it = 1 + ()
*Main> :e
*** Exception: <interactive>: canonicalizePath: does not exist (No such file or directory)
*Main> 

The contents of test.hs is not important as long as there is a file to edit.

Editing works fine before the type-error on the command line.

Change History (7)

comment:1 Changed 3 years ago by glguy

Version: 7.117.10.1-rc2

This is a regression in the 7.10 series relative to 7.8

comment:2 Changed 2 years ago by archblob

Owner: set to archblob

comment:3 Changed 2 years ago by archblob

Differential Rev(s): Phab:D930

comment:4 Changed 2 years ago by thoughtpolice

Milestone: 7.10.2
Status: newpatch

comment:5 Changed 2 years ago by thoughtpolice

Status: patchmerge

comment:6 Changed 2 years ago by Austin Seipp <austin@…>

In 4756438962a76d2dcedf63b90ec789cb054f9556/ghc:

Catch canonicalizePath exceptions, fix #10101

Summary:
Introduce by #95 'canonicalizePath' throws and exception when given
an invalid file in a call to 'sameFile'.

There are two cases when this can happen when using ghci:
  1) If there is an error at the interactive prompt, "<interactive>"
     file is searched for and not found.
  2) If there is an error in any loaded file and editing an inexistent/new
     file with 'e: foo'.

Both cases are now tested.

Test Plan: validate

Reviewers: austin, #ghc

Reviewed By: austin, #ghc

Subscribers: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D930

GHC Trac Issues: #10101

comment:7 Changed 2 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.