bug#79762: Guile may run stale code if source changes too quickly

Ludovic Courtès <[email protected]> Thu, 06 Nov 2025 10:05:17 +0100
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Hi Rob,

Rob Browning <[email protected]> skribis:

> To fix this, we can change compiled_is_fresh in load.c to require the
> .go to be strictly newer than the corresponding .scm, i.e. change the <=3D
> to < here:
>
>   if (source_mtime.tv_sec < compiled_mtime.tv_sec
>       || (source_mtime.tv_sec =3D=3D compiled_mtime.tv_sec
>           && source_mtime.tv_nsec <=3D compiled_mtime.tv_nsec))
>     compiled_is_newer =3D 1;
>   ...
>
> and in more-recent? in boot-9.scm, change >=3D to > here:
>
>         (and (=3D (stat:mtime stat1) (stat:mtime stat2))
>              (>=3D (stat:mtimensec stat1)
>                  (stat:mtimensec stat2)))))

While this change is justified by the examples you gave, I think it
would cause problems you wouldn=E2=80=99t expect.

In particular, in Guix and Nix, timestamps on build artifacts are reset
to the Epoch + 1 second, for reproducibility purposes.  This means that
.scm and .go files have the exact same timestamp.

With the change above, all .go files would be considered stale and Guile
would end up auto-recompiling everything.

So I think we=E2=80=99ll have to leave that unchanged.

Now, I would hope that the problem you describe is rare enough in
practice that this is not too much of a problem?

Thanks,
Ludo=E2=80=99.