Opened 2 years ago

Closed 23 months 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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

#!/bin/bash
#
# file preprocess.sh
#
cat $2 > $3
sleep 1
touch $1
-- file Foo.hs
{-# OPTIONS_GHC -F -pgmF ./preprocess.sh #-}
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 2 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 2 years ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 7.4.2
  • Owner set to simonmar
  • Priority changed from normal to high

I'll look into this.

comment:3 Changed 2 years ago by marlowsd@…

commit d82da293078b00d0f2d85c947e70382d398aab64

Author: Simon Marlow <marlowsd@gmail.com>
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 2 years ago by simonmar

  • Status changed from new to merge

comment:5 Changed 23 months ago by pcapriotti

  • Resolution set to fixed
  • Status changed from merge to closed
Note: See TracTickets for help on using tickets.