-
Notifications
You must be signed in to change notification settings - Fork 416
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
jbuilder shouldn't fail on unreadable directories #310
Comments
It's not clear to me why you'd want to run that from |
Thanks. As to why, I’m just following instructions from opam packages that fail to build. I don’t actually know what those jbuilder args do, although I can kind of guess. Would be worse for novice users, though. (The instructions never say “Go to a directory without unreadable subdirs and run this.” :-) |
The opam package is (I hope) not telling you to run arbitrary commands from your |
Jane Street Core can generate output that suggests running the command in response to
I think this is what originally caused me to run I originally assumed that the last line in the message was generated by something in the Core config, but I searched for parts of it on the Core repo on github and didn't find it. I think I got a similar "Hint" from some other (That's one case. I got a similar message when a different package that core needed was missing--don't remember which one.) |
Hmm - the second line of opam's output says what path it started in. I must confess I'm not convinced that one would ever arbitrarily run a command in @rgrinberg Thoughts? |
(Unrelated to jbuilder, but this looks like a packaging problem of some kind) |
Right. Only the failing on unreadable directories issue is jbuilder's. The packaging problem just illustrates a case in which that matters more. (This probably goes without saying, but I think it's important that one of the positive benefits of the ease of opam (for which I'm grateful) is that it allows new users to start using OCaml without being knowledgeable about OCaml compilation or dependencies or any particular build tool. Then you can gradually learn different pieces of what is, overall, a very rich set of tools and libraries. If a less-knowledgeable user gets a message while running opam that says "that didn't work, but try this", it should be entirely appropriate for the user simply try that in the way specified, without first, say, figuring out what jbuilder does. The user didn't know what opam was doing before that point, either, after all, and simply trusted it. (In my case, I no longer consider myself a rank novice, but there's a lot that I don't know or don't understand, and I don't have time to become an OCaml expert before proceeding. If I get a message from opam that says "try this because I couldn't build your package", then yeah, I'm going to try it, just like I tried running opam to install the package in the first place. I only started using jbuilder a couple of months ago--before that I only (kind of) knew oasis--and I know enough to do what I do with jbuilder, and keep learning more, but I don't have time to understand everything about it. The fact that the jbuilder docs aren't very good for the initial learning process doesn't help, but that's another issue.) |
Sorry if the way I put the aside made it unclear - there's no question that your original issue about scanning unreadable directories is a bug to be fixed! What I'm musing on is the value of changing the error message, and it's not totally clear-cut. For example, it's interesting that you dived in running a command rather than reading the line above which said that a package is missing (by 'interesting', I don't necessarily mean you wrong!) |
The issue here is that opam is trying to install When jbuilder tries to build something and kind find a dependency it prints the hint "try: jbuilder external-lib-deps ..." to help you figure out what dependencies are missing. If you had been running jbuilder yourself in the The solution is probably to try to distinguish these two different use cases -- building a package in a package manager and running jbuilder by hand -- and then tailor the error messages and hints accordingly. |
@lpw25 Ah, I see. It's jbuilder that inserts the hint message. I couldn't figure out where that was coming from. @dra27, I guess what happens is that I expect opam to manage dependencies. If core needs base, I would expect base to get installed when I try to install core. If that doesn't happen, it seems weird, and I'm not sure what to do. As it turns out, running |
@lpw25 Maybe it would be simpler for the hint to include full build directory path when the problem occurs. That should work both for the normal jbuild process and for opam use. |
The directory isn't what's wrong with the hint. Running that command is not going to help a user work out what is wrong in this situation any more than the error message |
Ah, I get it. I am exhibit A. :-) I think I should let someone else submit an issue about this, if that makes sense, since I don't understand the situation as well. |
#2004 fixes this. Interested parties should test that PR. |
CHANGES: - Warn when generated `.merlin` does not reflect the preprocessing specification. This occurs when multiple stanzas in the same directory use different preprocessing specifications. This warning can now be disabled with `allow_approx_merlin` (ocaml/dune#1947, fix ocaml/dune#1946, @rgrinberg) - Watch mode: display "Success" in green and "Had errors" in red (ocaml/dune#1956, @emillon) - Fix glob dependencies on installed directories (ocaml/dune#1965, @rgrinberg) - Add support for library variants and default implementations. (ocaml/dune#1900, @TheLortex) - Add experimental `$ dune init` command. This command is used to create or update project boilerplate. (ocaml/dune#1448, fixes ocaml/dune#159, @shonfeder) - Experimental Coq support (fix ocaml/dune#1466, @ejgallego) - Install .cmi files of private modules in a `.private` directory (ocaml/dune#1983, fix ocaml/dune#1973 @rgrinberg) - Fix `dune subst` attempting to substitute on directories. (ocaml/dune#2000, fix ocaml/dune#1997, @rgrinberg) - Do not list private modules in the generated index. (ocaml/dune#2009, fix ocaml/dune#2008, @rgrinberg) - Warn instead of failing if an opam file fails to parse. This opam file can still be used to define scope. (ocaml/dune#2023, @rgrinberg) - Do not crash if unable to read a directory when traversing to find root (ocaml/dune#2024, @rgrinberg) - Do not exit dune if some source directories are unreadable. Instead, warn the user that such directories need to be ignored (ocaml/dune#2004, fix ocaml/dune#310, @rgrinberg) - Fix nested `(binaries ..)` fields in the `env` stanza. Previously, parent `binaries` fields would be ignored, but instead they should be combined. (ocaml/dune#2029, @rgrinberg) - Allow "." in `c_names` and `cxx_names` (ocaml/dune#2036, fix ocaml/dune#2033, @rgrinberg)
CHANGES: - Warn when generated `.merlin` does not reflect the preprocessing specification. This occurs when multiple stanzas in the same directory use different preprocessing specifications. This warning can now be disabled with `allow_approx_merlin` (ocaml/dune#1947, fix ocaml/dune#1946, @rgrinberg) - Watch mode: display "Success" in green and "Had errors" in red (ocaml/dune#1956, @emillon) - Fix glob dependencies on installed directories (ocaml/dune#1965, @rgrinberg) - Add support for library variants and default implementations. (ocaml/dune#1900, @TheLortex) - Add experimental `$ dune init` command. This command is used to create or update project boilerplate. (ocaml/dune#1448, fixes ocaml/dune#159, @shonfeder) - Experimental Coq support (fix ocaml/dune#1466, @ejgallego) - Install .cmi files of private modules in a `.private` directory (ocaml/dune#1983, fix ocaml/dune#1973 @rgrinberg) - Fix `dune subst` attempting to substitute on directories. (ocaml/dune#2000, fix ocaml/dune#1997, @rgrinberg) - Do not list private modules in the generated index. (ocaml/dune#2009, fix ocaml/dune#2008, @rgrinberg) - Warn instead of failing if an opam file fails to parse. This opam file can still be used to define scope. (ocaml/dune#2023, @rgrinberg) - Do not crash if unable to read a directory when traversing to find root (ocaml/dune#2024, @rgrinberg) - Do not exit dune if some source directories are unreadable. Instead, warn the user that such directories need to be ignored (ocaml/dune#2004, fix ocaml/dune#310, @rgrinberg) - Fix nested `(binaries ..)` fields in the `env` stanza. Previously, parent `binaries` fields would be ignored, but instead they should be combined. (ocaml/dune#2029, @rgrinberg) - Allow "." in `c_names` and `cxx_names` (ocaml/dune#2036, fix ocaml/dune#2033, @rgrinberg) - Format rules: if a dune file uses OCaml syntax, do not format it. (ocaml/dune#2014, fix ocaml/dune#2012, @emillon)
jbuilder fails if there is any unreadable directory under the current directory:
It's arguable that this isn't a serious problem for building one's own projects, but it's common to be told to run the above command e.g. when there's a problem with an installation of some package via opam. If you run that command from e.g. your
$HOME
directory (why wouldn't you?), then any unreadable directory under that location that can be found e.g. via links stop the process. (In my case, I have a couple of directories of my own that I've set to be unreadable for my own reasons. One could imagine cases in which someone has a link into a tree belonging to another user or root or something like that, where only some of the directories are readable.)It seems like it would make more sense to simply ignore unreadable directories, or possibly issue a warning and continue.
The text was updated successfully, but these errors were encountered: