Closed symphorien closed 3 years ago
Pings are intended to cause unconditional evaluation, that’s their primary use. The watcher will create its own events when a file changes, so I don’t see what this would give us?
Lorri direnv sends a ping, I assume that was the reason for this issue?
It should probably send something that has the behavior you propose instead.
Lorri direnv sends a ping, I assume that was the reason for this issue?
Yes.
I am quite sure the expected behavior I describe is the previous behavior. I have been using lorri direnv as long as I have been using lorri, and this is a new regression. It results in a very noticeable behavior: every time the prompt is displayed, lorri reevaluates and direnv displays that is redefines the environment.
Pings are intended to cause unconditional evaluation, that’s their primary use
I think ping is meant to trigger a rebuild only if the directory was not already watched, so that when you first enter the repo you build it, because maybe something changed in the repo when it was not watched. But afterwards, it serves no purpose, as inotify is enough. nix-direnv sends a ping on very prompt display in order to notify on the "first entering the repo" event.
But afterwards, it serves no purpose, as inotify is enough.
Bear in mind that ping
is an internal command to serve mainly for debugging issues. I wouldn’t trust the file watcher in all cases.
But you are right, we should switch direnv over to only trigger a reeval only when nothing was watched yet, e.g. by introducing a start-watching
command.
As to it not being the case until the rewrite, it might just have been a side effect of the general brokenness of the builder. I’m certain that the semantics of ping has always been “schedule a rebuild unconditionally”.
Having lorri direnv use a new start-watching command looks good.
Describe the bug lorri 1.3 evaluates shell.nix on all pings, an not only on the first one.
To Reproduce Steps to reproduce the behavior:
Log:
Expected behavior Lorri should evaluate shell.nix (that is, run nix-instantiate) only:
Metadata
Reproduced on top of a26745e404c3a201fe98af4c000bb27f910542b1