Skip to content
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

confusing error on incorrect _CoqProject file #707

Closed
gasche opened this issue Oct 3, 2023 · 0 comments · Fixed by #708
Closed

confusing error on incorrect _CoqProject file #707

gasche opened this issue Oct 3, 2023 · 0 comments · Fixed by #708

Comments

@gasche
Copy link
Contributor

gasche commented Oct 3, 2023

The error

I have an incorrect _CoqProject file with the following content:

-R Category

When running Emacs+PG on a .v file in the same directory, the "Next step" or "Use buffer" commands error with an obscure message:

Bad bounding indices: 0, 2

Repro script:

$ mkdir repro
$ cd repro
$ echo "-R Foo" > _CoqProject
$ echo "Check true." > test.v
$ emacs test.v

Versions:

  • Emacs: 28.3
  • PG 20230414.931 from Elpa

(I observed the failure on older versions before, but I tried to make the issue go away by upgrading.)

How I traced the error to the _CoqProject

I googled "Bad bounding indices", there were no hits whatsoever on the Coq resources, but some Github issues on some totally unrelated Emacs modes that were related to the cl-subseq function.

I then grepped the PG sources, there is a single use of cl-subseq:

PG/coq/coq-system.el

Lines 550 to 559 in e7aad1d

(defun coq--read-one-option-from-project-file (switch arity raw-args)
"Cons SWITCH with ARITY arguments from RAW-ARGS.
If ARITY is nil, return SWITCH."
(if arity
(let ((arguments
(condition-case-unless-debug nil
(cl-subseq raw-args 0 arity)
(warn "Invalid _CoqProject: not enough arguments for %S" switch))))
(cons switch arguments))
switch))

It looks like the code is trying to be robust against failures, but for some reason (maybe the unless-debug part?) this attempt fails on my machine and PG is unusable with broken _CoqProject files -- with a very obscure error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant