8000 fix: failing coq --config by Alizter · Pull Request #8966 · ocaml/dune · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: failing coq --config #8966

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

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

Alizter
Copy link
Collaborator
@Alizter Alizter commented Oct 18, 2023

The first commit adds a test detailing how Dune reacts to coqc --version and coqc --config failing. We write down what we expect to happen in each situation.

The second commit does a few things:

  • Cleans up how coq_config is handled, shares more code, streamlines the API (removing make_exn).
  • We start passing -boot to coqc --print-version to make it work when only coq-core is around.
  • We make sure that the failure of coqc --config does not inhibit the build. There is a check for the config in the installed theories composition for example. We emit a warning if config fails and do a best effort without any installed theories.
  • We improve error messages elsewhere where config or version are requested but could fail.

I don't think this needs a version bump as it affects a very small minority of users who build with only coq-core.

@Alizter Alizter requested a review from ejgallego October 18, 2023 15:29
@ejgallego ejgallego self-assigned this Oct 18, 2023
@ejgallego
Copy link
Collaborator

Thanks a lot Ali! I will review tomorrow (if you need a review)

@Alizter
Copy link
Collaborator Author
Alizter commented Oct 18, 2023

@ejgallego A look over would be nice. I think just reading what I've written in the test and whether that makes sense would be enough.

@LasseBlaauwbroek
Copy link
Contributor

Thanks @Alizter !

Copy link
Collaborator
@ejgallego ejgallego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Ali! I let you merge.

I wonder if maybe a general mechanism to query this kind of programs, and handle errors in the same way would be of interest to Dune?

We could have helpers to implement some common operations, for example, to provide default values.

@Alizter
Copy link
Collaborator Author
Alizter commented Oct 19, 2023

@ejgallego If you have a look, its easy to see that coq_config is inspired by the handling in OCaml. I don't see much utility in sharing code here as each has very specific needs. ocamlc --config is also much stabler compared to Coq. It will probably end up being more of a maintenance burden to share code here, especially if in the far future Coq support becomes a plugin.

@Alizter
Copy link
Collaborator Author
Alizter commented Oct 19, 2023

Before we merge, I need to push a changelog entry.

@ejgallego
Copy link
Collaborator

Before we merge, I need to push a changelog entry.

Indeed, sorry I forgot about this!

Regarding the handling of the commands, I was thinking more about making an extension of Memo.exec that is a bit more convenient to use w.r.t. error handling.

But indeed not a lot to gain right now I think? It seems dune has about 50 uses of it, so I'm unsure.

@Alizter Alizter force-pushed the ps/branch/test__failing_coq___config branch from 487ede8 to 1f89ef1 Compare October 20, 2023 00:31
@Alizter
Copy link
Collaborator Author
Alizter commented Oct 20, 2023

I've added a changelog entry. @rgrinberg can you take a quick look and/or merge?

@Alizter Alizter added the coq label Oct 20, 2023
@ejgallego
Copy link
Collaborator

@Alizter what's blocking this? I'd suggest amending a bit the changes entry, otherwise I suggest we merge.

@Alizter
Copy link
Collaborator Author
Alizter commented Oct 25, 2023

@ejgallego I can't amend the changelog just yet. So if you want to do it feel free. There is nothing else blocking this AFAIK.

@ejgallego
Copy link
Collaborator

@Alizter sounds good, I will amend and merge if I get a minute, otherwise you feel free to go ahead.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@ejgallego ejgallego force-pushed the ps/branch/test__failing_coq___config branch from 1f89ef1 to bfa803b Compare October 25, 2023 16:28
We fix a bug where coqc --config or --print-version would fail in some
situations leaving the user with a half baked message and no clear way
forward. This can happen for example when using only coq-core.

In order to fix this, we make config return a more principled result
type allowing consumers of the API to handle such errors in a better
fashion.

We also now pass `-boot` to `coqc --print-version` which is identical,
but works around a bug in Coq which caused failures when only coq-core
is installed.

We also improve various error messages that occur when Dune's internal
queries to coqc fail.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@ejgallego ejgallego force-pushed the ps/branch/test__failing_coq___config branch from bfa803b to 1247850 Compare October 25, 2023 16:29
@ejgallego ejgallego merged commit 0226654 into ocaml:main Oct 25, 2023
emillon added a commit to emillon/opam-repository that referenced this pull request Nov 28, 2023
CHANGES:

- Introduce `$ dune ocaml doc` to open and browse documentation. (ocaml/dune#7262, fixes
  ocaml/dune#6831, @EmileTrotignon)

- `dune cache trim` now accepts binary byte units: `KiB`, `MiB`, etc. (ocaml/dune#8618,
  @Alizter)

- No longer force colors for OCaml 4.03 and 4.04 (ocaml/dune#8778, @rgrinberg)

- Introduce new experimental odoc rules (ocaml/dune#8803, @jonjudlam)

- Introduce the `runtest_alias` field to the `cram` stanza. This allows
  removing default `runtest` alias from tests. (@rgrinberg, ocaml/dune#8887)

- Do not ignore libraries named `bigarray` when they are defined in conjunction
  with OCaml 5.0 (ocaml/dune#8902, fixes ocaml/dune#8901, @rgrinberg)

- Dependencies in the copying sandbox are now writeable (ocaml/dune#8920, @rgrinberg)

- Absent packages shouldn't prevent all rules from being loaded (ocaml/dune#8948, fixes
  ocaml/dune#8630, @rgrinberg)

- Correctly determine the stanza of menhir modules when `(include_subdirs
  qualified)` is enabled (@rgrinberg, ocaml/dune#8949, fixes ocaml/dune#7610)

- Display cache location in Dune log (ocaml/dune#8974, @nojb)

- Re-run actions whenever `(expand_aliases_in_sandbox)` changes (ocaml/dune#8990,
  @rgrinberg)

- Rules that only use internal dune actions (`write-file`, `echo`, etc.) can
  now be sandboxed. (ocaml/dune#9041, fixes ocaml/dune#8854, @rgrinberg)

- Do not re-run rules when their location changes (ocaml/dune#9052, @rgrinberg)

- Correctly ignore `bigarray` on recent version of OCaml (ocaml/dune#9076, @rgrinberg)

- Add `test_` prefix to default test name in `dune init project` (ocaml/dune#9257, fixes
  ocaml/dune#9131, @9sako6)

- Add `coqdoc_flags` field to `coq` field of `env` stanza allowing the setting
  of workspace-wide defaults for `coqdoc_flags`. (ocaml/dune#9280, fixes ocaml/dune#9139, @Alizter)

- [coq rules] Be more tolerant when coqc --print-version / --config don't work
  properly, and fallback to a reasonable default. This fixes problems when
  building Coq projects with `(stdlib no)` and likely other cases. (ocaml/dune#8966, fix
  ocaml/dune#8958, @Alizter, reported by Lasse Blaauwbroek)

- Dune will now run at a lower framerate of 15 fps rather than 60 when
  `INSIDE_EMACS`. (ocaml/dune#8812, @Alizter)

- dune-build-info: when `version=""` is found in a `META` file, we now return
  `None` as a version string (ocaml/dune#9177, @emillon)

- Dune can now be built and installed on Haiku (ocaml/dune#8795, fix ocaml/dune#8551, @Alizter)

- Mark installed directories in `dune-package` files. This fixes `(package)`
  dependencies against packages that contain such directories. (ocaml/dune#8953, fixes
  ocaml/dune#8915, @emillon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Coq] (stdlib no) broken since 3.8.0
3 participants
0