-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache: some permissions can't be represented, causing cache misses #11533
Comments
Signed-off-by: Etienne Millon <me@emillon.org>
Signed-off-by: Etienne Millon <me@emillon.org>
This depends on the currently set |
Signed-off-by: Etienne Millon <me@emillon.org>
Signed-off-by: Etienne Millon <me@emillon.org>
Out of curiosity, why don't we |
Yes that would work too, but there's no room for this metadata at the moment. |
Ah you mean that the cache only differentiates between executable and non-executable? Yes, in that case I totally see your point (and #11541 is then the only right way to deal with it), but maybe it would be worth considering whether we want to record the exact permissions in the cache instead. I honestly don't know, thus I am curious why |
The git approach makes sense to me, and I think the same thought process should apply to dune cache:
|
Signed-off-by: Etienne Millon <me@emillon.org>
CHANGES: ### Fixed - Support HaikuOS: don't call `execve` since it's not allowed if other pthreads have been created. The fact that Haiku can't call `execve` from other threads than the principal thread of a process (a team in haiku jargon), is a discrepancy to POSIX and hence there is a [bug about it](https://dev.haiku-os.org/ticket/18665). (@Sylvain78, ocaml/dune#10953) - Fix flag ordering in generated Merlin configurations (ocaml/dune#11503, @voodoos, fixes ocaml/merlin#1900, reported by @vouillon) ### Added - Add `(format-dune-file <src> <dst>)` action. It provides a replacement to `dune format-dune-file` command. (ocaml/dune#11166, @nojb) - Allow the `--prefix` flag when configuring dune with `ocaml configure.ml`. This allows to set the prefix just like `$ dune install --prefix`. (ocaml/dune#11172, @rgrinberg) - Allow arguments starting with `+` in preprocessing definitions (starting with `(lang dune 3.18)`). (@amonteiro, ocaml/dune#11234) - Support for opam `(maintenance_intent ...)` in dune-project (ocaml/dune#11274, @art-w) - Validate opam `maintenance_intent` (ocaml/dune#11308, @art-w) - Support `not` in package dependencies constraints (ocaml/dune#11404, @art-w, reported by @hannesm) ### Changed - Warn when failing to discover root due to reads failing. The previous behavior was to abort. (@KoviRobi, ocaml/dune#11173) - Use shorter path for inline-tests artifacts. (@hhugo, ocaml/dune#11307) - Allow dash in `dune init` project name (ocaml/dune#11402, @art-w, reported by @saroupille) - On Windows, under heavy load, file delete operations can sometimes fail due to AV programs, etc. Guard against it by retrying the operation up to 30x with a 1s waiting gap (ocaml/dune#11437, fixes ocaml/dune#11425, @MSoegtropIMC) - Cache: we now only store the executable permission bit for files (ocaml/dune#11541, fixes ocaml/dune#11533, @ElectreAAS) - Display negative error codes on Windows in hex which is the more customary way to display `NTSTATUS` codes (ocaml/dune#11504, @MisterDA)
CHANGES: ### Fixed - Support HaikuOS: don't call `execve` since it's not allowed if other pthreads have been created. The fact that Haiku can't call `execve` from other threads than the principal thread of a process (a team in haiku jargon), is a discrepancy to POSIX and hence there is a [bug about it](https://dev.haiku-os.org/ticket/18665). (@Sylvain78, ocaml/dune#10953) - Fix flag ordering in generated Merlin configurations (ocaml/dune#11503, @voodoos, fixes ocaml/merlin#1900, reported by @vouillon) ### Added - Add `(format-dune-file <src> <dst>)` action. It provides a replacement to `dune format-dune-file` command. (ocaml/dune#11166, @nojb) - Allow the `--prefix` flag when configuring dune with `ocaml configure.ml`. This allows to set the prefix just like `$ dune install --prefix`. (ocaml/dune#11172, @rgrinberg) - Allow arguments starting with `+` in preprocessing definitions (starting with `(lang dune 3.18)`). (@amonteiro, ocaml/dune#11234) - Support for opam `(maintenance_intent ...)` in dune-project (ocaml/dune#11274, @art-w) - Validate opam `maintenance_intent` (ocaml/dune#11308, @art-w) - Support `not` in package dependencies constraints (ocaml/dune#11404, @art-w, reported by @hannesm) ### Changed - Warn when failing to discover root due to reads failing. The previous behavior was to abort. (@KoviRobi, ocaml/dune#11173) - Use shorter path for inline-tests artifacts. (@hhugo, ocaml/dune#11307) - Allow dash in `dune init` project name (ocaml/dune#11402, @art-w, reported by @saroupille) - On Windows, under heavy load, file delete operations can sometimes fail due to AV programs, etc. Guard against it by retrying the operation up to 30x with a 1s waiting gap (ocaml/dune#11437, fixes ocaml/dune#11425, @MSoegtropIMC) - Cache: we now only store the executable permission bit for files (ocaml/dune#11541, fixes ocaml/dune#11533, @ElectreAAS) - Display negative error codes on Windows in hex which is the more customary way to display `NTSTATUS` codes (ocaml/dune#11504, @MisterDA)
Since #11541 solved this, should we close this issue? |
In a nutshell: in some cases, dune will restore some artifacts in a way that causes subsequent runs to digest them differently.
Reproduction case
This can be reproduced in the following cram test:
When the action is executed, the directory is created with mode 755 (in particular,
g-w
), but when it it restored, it gets mode 775 (in particularg+w
).This causes a cache miss because the stored result for the rule that produces
other
has a different digest for its dependencyd
.The third run can restore cleanly because it has cached the 775 version.
(note that this behavior does not happen if
chmod 775
is in thedune
file; and that the issue also happens when a subdirectory of the directory target has such a permission)Expected behavior
The expected behavior would be that the second run can build cleanly (with only cache hits).
Context
This issue manifests itself in the package management rules. In particular,
ocamlfind.1.9.6+dune
will createocamlfind/target/bin/
with mode 755, so cleaning and rebuilding will restore a different version ofocamlfind/target/bin/
(with mode 775) and trigger rebuilds of all the packages that depend onocamlfind
. And if such dependent packages have similar directory permissions, they will be rebuilt on subsequent builds.Suggested solution
Storing just an executable bit instead of the full permissions seems like a good tradeoff - this is what
git
does for example.To fix this issue, digesting could be changed to only take into account what is going to be restored. For example, by clearing or normalizing the group bits in
Digest.Stats_for_digest.of_unix_stats
, or maybe by replacing that part by just anexecutable
boolean.FTR,
git
determines that a file is executable by checking if any of the+x
bits are set.@mefyl also mentioned that something similar might be happening with the
+w
bits - when hardlinking we reset these bits so they might alter the digest.The text was updated successfully, but these errors were encountered: