Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,360
    • Issues 5,360
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #19299
Closed
Open
Issue created Feb 02, 2021 by Roland Senn@RolandSennDeveloper

GHCi crashes with external interpreter and user defined prompt function

Summary

GHCi crashes in :set prompt-function after switching on or off the external interpreter.

Steps to reproduce

1. Switch off external-interpreter

$ ghci Test.hs -fexternal-interpreter
GHCi, version 8.10.2: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Test             ( Test.hs, interpreted )
Ok, one module loaded.
*Test> :set prompt-function myprompt
ghc: this operation requires -fno-external-interpreter
*Test> :set -fno-external-interpreter
*Test> :set prompt-function myprompt
ghc-iserv: {handle: <file descriptor: 23>}: GHCi.Message.remoteCall: end of file
Speicherzugriffsfehler

Speicherzugriffsfehler is the German word for access violation.

2. Switch on external-interpreter

$ ghci Test.hs
GHCi, version 8.10.2: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Test             ( Test.hs, interpreted )
Ok, one module loaded.
*Test> :set prompt-function myprompt
*Test 2_: :set -fexternal-interpreter
*Test 3_: :set prompt-function myprompt
ghc: ghc-iserv terminated (-11)
Leaving GHCi.

The contents of Test.hs is:

import Data.List (intersperse)

myprompt :: [String] -> Int -> IO String
myprompt mod_names stmt_nr =
    return $ concat (intersperse " " mod_names) ++ " " ++ show stmt_nr ++ "_: "

Expected behavior

  • GHCi should not crash, ghc-iserv should not terminate.
  • Don't allow the use of :set -fexternal-interpreter or :set -fno-external-interpreter in the middle of a GHCi session. Both flags should be command-line only.

Environment

  • GHC version used: 8.10.2

Optional:

  • Operating System: Debian GNU/Linux 10
  • System Architecture: x86-64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking