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

mirage 4.5.0 errors report sometimes off-by-one #1528

Closed
Tracked by #1536
hannesm opened this issue May 6, 2024 · 1 comment · Fixed by #1540
Closed
Tracked by #1536

mirage 4.5.0 errors report sometimes off-by-one #1528

hannesm opened this issue May 6, 2024 · 1 comment · Fixed by #1540

Comments

@hannesm
Copy link
Member

hannesm commented May 6, 2024

Hey,

so I have the following generated file -- :

# 171 "mirage/main.ml"

let mirage_runtime__11 = lazy (
  let __struct_end__2 = Lazy.force struct_end__2 in
  let __printexc__3 = Lazy.force printexc__3 in
  let __hashtbl__4 = Lazy.force hashtbl__4 in
  let __gc__5 = Lazy.force gc__5 in
  let __mirage_runtime__6 = Lazy.force mirage_runtime__6 in
  let __mirage_logs_make__8 = Lazy.force mirage_logs_make__8 in
  let __unikernel_hello__10 = Lazy.force unikernel_hello__10 in
  __struct_end__2 >>= fun _struct_end__2 ->
  __printexc__3 >>= fun _printexc__3 ->
  __hashtbl__4 >>= fun _hashtbl__4 ->
  __gc__5 >>= fun _gc__5 ->
  __mirage_runtime__6 >>= fun _mirage_runtime__6 ->
  __mirage_logs_make__8 >>= fun _mirage_logs_make__8 ->
  __unikernel_hello__10 >>|= fun _unikernel_hello__10 ->
# 384 "lib/mirage.ml"
  return ()
);;
# 191 "mirage/main.ml"

Emacs agrees with the line number: the directive # 171 is on line 171, the directive # 191 on line 191.

When I run a make build, I get:

File "mirage/main.ml", line 186, characters 24-28:
Error: Unbound value >>|=
Hint: Did you mean >>= or >|=?

But the use of >>|= is in line 187, characters 24-28. How can that be?

If you need a full example, the above is from mirage-skeleton/tutorial/hello with a mirage configure -t hvt and then a manual edit of the file (to inject bad syntax).

@hannesm
Copy link
Member Author

hannesm commented May 6, 2024

AFAICT all mirage/main line number directives are off-by-one.

@hannesm hannesm mentioned this issue May 16, 2024
14 tasks
samoht added a commit to samoht/mirage that referenced this issue May 17, 2024
hannesm pushed a commit to samoht/mirage that referenced this issue May 17, 2024
hannesm added a commit that referenced this issue May 17, 2024
* internal: Fix off-by-one locations in mirage/main.ml

Fix #1528

* Promote tests

* fix, use 2 offset, add comment

* promote tests

---------

Co-authored-by: Hannes Mehnert <hannes@mehnert.org>
hannesm added a commit to hannesm/opam-repository that referenced this issue May 17, 2024
CHANGES:

- BREAKING: remove `~name` parameter from Mirage.Runtime_args.create
  (mirage/mirage#1541 @samoht, fixes mirage/mirage#1532)
- BREAKING: remove `~name` parameter from Mirage.runtime_arg, and use a
  string (instead of a format string) as third parameter (mirage/mirage#1541 @samoht)
- constrain the `start` function to `unit Lwt.t`. Previously, there was no
  restrictions, and lots of time was spent in debugging when a unikernel
  resulted in `unit Lwt.t Lwt.t` (@Julow mirage/mirage#1524)
- revise man page sections and ordering: ARGUMENTS, OPTIONAL, NETWORK OPTIONS,
  DISK OPTIONS, LOG AND MONITORING OPTIONS, OCAML RUNTIME OPTIONS. Previously,
  the ARGUMENTS and OPTIONS were put later, and were hard to find. These are
  the sections where unikernel-specific arguments are put by default
  (mirage/mirage#1531 @hannesm @reynir)
- add --net=host and --net=ocaml to reduce confusion. --net=host uses the
  TCP/IP socket stack, --net=ocaml the OCaml network stack (mirage/mirage#1525 @hannesm)
- quote Runtime_arg.call (mirage/mirage#1522 @Julow)
- documentation fixes (inline examples @Julow mirage/mirage#1523, @hannesm mirage/mirage#1537 (fixes
  mirage/mirage#1512 reported by @reynir), Runtime_args.create mirage/mirage#1541 @samoht)
- fix the build instructions of the generated opam file: since 4.5.0
  `mirage build` is no longer available, use `make "build"` (mirage/mirage#1527 @hannesm)
- add RELEASE.md, a guide on how to cut a mirage release (mirage/mirage#1519 @samoht)
- allow git 3.16 (mirage/mirage#1536 @hannesm)
- use mirage-bootvar (using dune variant) instead of parse-argv and
  mirage-bootvar-xen, mirage-bootvar-solo5, mirage-bootvar-unix
  (mirage/mirage#1533 @hannesm)
- BUGFIX: reset the lexer location before applying functors in generated code
  (mirage/mirage#1539 @samoht, fixes mirage/mirage#1520 @hannesm)
- BUGFIX: fix off-by-one locations for mirage/main.ml (mirage/mirage#1540 @samoht, fixes
  mirage/mirage#1528 @hannesm)
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