-
Notifications
You must be signed in to change notification settings - Fork 411
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
Dune should document that files cannot be marked as writeable #5570
Comments
As you can see dune seems to fail because the target can't be read anymore, so removing read right is also wrong. I would not phrase that files in the NB: it is documented |
Possible improvement: add to the documentation about targets that the write permission is removed and that the targets must have the read permission at the end of the rule. |
@bobot Perhaps adding r to this example was a bit distracting, it was to demonstrate that w is the only thing that can't be preserved. |
It would be a nice feature to systematically avoid certain rules from being cached. That way, we could safely (w.r.t cache) allow certain rules to have writable targets. We currently have Of course allowing writable targets pretty much goes against dunes design and is probably a foot gun. The reason this example came up at all was in the context of moving from a makefile based build to a dune one. It was somewhat confusing when the permissions didn't act as expected, so making it clearer in the doc would probably be a good compromise. |
Many rules are not cached. But the sanity check of removing the write permission is always done. Lets focus on the doc. I think the modification is at the junior job level. |
As discussed privately with Ali, this is, in my view, more of a question about what to do with rules that update targets, that is to say, cyclic in nature. It seems to me that the most natural way is indeed to use a regular rule |
We can add in the documentation an how-to that describes the promote way for cache. "updates" rules can be quite similar to "fixpoint" rules (e.g. latex rules), which is a big can of worms. A separate RFC that describes the cache use case would be a first step, but I think we should try to have a very specific feature in order to not get an hacked dependency semantic. |
Here is a cram test to demonstrate some non-obvious behaviour:
This gives an output of:
(Of course the output of ls will need to be scrubbed to make this a proper test).
As you can see reading can be changed, executing can be changed, but writing seems to get overridden by dune at some point. In the rule, dune reports that copy.txt is writeable yet it is actually not after dune has finished.
This is of course perhaps intentional behaviour by dune, allowing users to produce rules with writeable targets is probably a foot gun. However as my example indicates, it is not so obvious that this behaviour is happening.
So perhaps dune should document somewhere that the permissions of files in the _build directory cannot become writeable, at least if the file is a target or dependency. There are of course untracked files that can be.
cc @rgrinberg
The text was updated successfully, but these errors were encountered: