Opened 5 years ago

Closed 5 years ago

#6106 closed bug (fixed)

GHCi does not always detect when modules become stale during compilation

Reported by: SimonHengel Owned by: simonmar
Priority: high Milestone: 7.4.2
Component: GHCi Version: 7.4.1
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Here is a conceived example that illustrates the issue.

File Foo.hs is changed after it's content has been read in the Haskell pre-processor phase.

# file
cat $2 > $3
sleep 1
touch $1
-- file Foo.hs
{-# OPTIONS_GHC -F -pgmF ./ #-}
module Foo where
$ ghci Foo.hs
*Foo> :reload

Expected result: Foo.hs is recompiled on :reload

Actual result: Nothing is recompiled on :reload

Change History (5)

comment:1 Changed 5 years ago by SimonHengel

For some reason, if I included Foo.hs in some other module and invoke ghci on that other module, everything works fine.

Say I have some Main.hs.

-- file Main.hs
import Foo

Now if I invoke ghci like so

$ ghci Main.hs

Foo.hs will be recompiled on each :reload.

But if I invoke ghci like so

$ ghci Main.hs Foo.hs

Foo.hs will not be recompiled on :reload

Is it, that GHC collects modification times differently for files that are given on the command line and files that are detected through dependency analysis?

comment:2 Changed 5 years ago by simonmar

difficulty: Unknown
Milestone: 7.4.2
Owner: set to simonmar
Priority: normalhigh

I'll look into this.

comment:3 Changed 5 years ago by marlowsd@…

commit d82da293078b00d0f2d85c947e70382d398aab64

Author: Simon Marlow <>
Date:   Tue May 22 11:51:46 2012 +0100

    Read the source file timestamp *before* preprocessing (#6106)

 compiler/main/GhcMake.hs |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

comment:4 Changed 5 years ago by simonmar

Status: newmerge

comment:5 Changed 5 years ago by pcapriotti

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.