Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

modified source files are not reliably detected due to filesystem timestamp resolution #172

Open
avh4 opened this issue Jul 9, 2017 · 1 comment

Comments

@avh4
Copy link

avh4 commented Jul 9, 2017

If an Elm file is modified less than one second after it is compiled, then future runs of elm-make will fail to recompile the file until it is modified again. I believe this is due to the fact that the filesystem (on Mac OS) only has one-second resolution. To fix this, I suspect elm-make should rebuild a file if the source file's timestamp is >= the .elmo file's timestamp (rather than only if it is >).

To reproduce, start with the following files:

A.elm

module A exposing (value)

import B
import C
import Html

value = "A0"

main = Html.text <| Debug.log "A" <| String.join ":" [ value, B.value, C.value ]

B.elm

module B exposing (value)

import C

value = "B0"

C.elm

module C exposing (value)

value = "C0"

Then use the following script:

go.sh

sed -i -e '/value =/{s/.*/value = "A1"/;}' A.elm
sed -i -e '/value =/{s/.*/value = "B1"/;}' B.elm
sed -i -e '/value =/{s/.*/value = "C1"/;}' C.elm
elm-make --yes B.elm --output /dev/null
sed -i -e '/value =/{s/.*/value = "B2"/;}' B.elm
elm-make --yes A.elm --output elm.js
node elm.js

Running go.sh produces:

Success! Compiled 2 modules.
Successfully generated /dev/null
Success! Compiled 1 module.
Successfully generated elm.js
A: "A1:B1:C1"

But it should produce A: "A1:B2:C1" (with B2) as the last line.

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@avh4 avh4 changed the title modified files are not reliably detected due to filesystem timestamp resolution modified source files are not reliably detected due to filesystem timestamp resolution Jul 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants