lib/eigen.eigs lexes "\r" as "r": under eigen_run, "a\rb" == "arb" is true (the VM says false)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Read the escape switches at lines 324-337 and 413-422 in lib/eigen.eigs, then compare them with src/lexer.c:565 and :696. Add suite coverage in the style of tests/test_meta_fstr_host_str.eigs and run those checks for plain strings and f-strings against the VM. Done means both forms decode \r to a carriage return and match the VM.
Written by the indexing model from the issue text.
Description
Found while root-causing an EigenRegex probe for InauguralSystems/EigenRegex#37, on the v0.46.0 release binary. lib/eigen.eigs is the same blob (bb721a65) on v0.46.0 and on main 5a7b703e.
Repro
import eigen
print of ("a\rb" == "arb")
print of (eigen.eigen_run of "\"a\\rb\" == \"arb\"")
print of (eigen.eigen_run of "f\"a\\rb\" == \"arb\"")
This prints false, true, true and exits 0. The VM decodes \r to a carriage return. The meta-interpreter decodes it to the letter r, in plain strings and in f-strings. The file's header promises evaluator values at parity with the C evaluator.
Root cause
Neither escape switch in lib/eigen.eigs has an r arm, so \r falls into the catch-all buf is buf + esc. The f-string switch is at lines 324-337 and the plain-string switch at lines 413-422. src/lexer.c:565 (f-strings) and :696 (plain strings) decode \r to CR. ouroboros had the same gap and fixed it in src/frontend.eigs:237-246, where the bootstrap fixed point caught it. This copy never got that fix.
Done when
- Both escape switches in
lib/eigen.eigsdecode\rto CR, assrc/lexer.c:565and:696do. - A suite test in the style of
tests/test_meta_fstr_host_str.eigscompareseigen_runwith the VM on both forms:
On v0.46.0 both checks fail, givingcheck of ["meta plain string decodes the r escape like the VM", eigen.eigen_run of "\"a\\rb\" == \"arb\"", "a\rb" == "arb"] check of ["meta f-string decodes the r escape like the VM", eigen.eigen_run of "f\"a\\rb\" == \"arb\"", f"a\rb" == "arb"]truewhere the VM givesfalse. With the two missing arms added to a scratch copy oflib/eigen.eigs, both pass.
Out of scope here: unknown escapes (\q, \0, \u212a) silently dropping the backslash in all three lexers is #1641.
- Dominant language
- C
- Stars
- 3
- Forks
- 7
- Avg merge
- 11h 30m
- Merged PRs (30d)
- 271
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from InauguralSystems/EigenScript
-
area:docs kind:docs-drift
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
InauguralSystems/EigenScript#1887 ·
Maintainers usually reply within 1 day
-
phase2: test_bitwise.eigs cites ctl.scan.* rows; the MAP's refusal controls are ctl.N8.refuse-*Openarea:gates kind:docs-drift
Difficulty 1/5 Under an hour Newbie friendliness 86/100
InauguralSystems/EigenScript#1851 ·
Maintainers usually reply within 1 day
-
area:gates area:gfx found-by:critic kind:gate-defect
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
InauguralSystems/EigenScript#1825 ·
Maintainers usually reply within 1 day
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atOpenarea:runtime-vm kind:silent-wrong
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
InauguralSystems/EigenScript#1748 · 1 comment ·
Maintainers usually reply within 1 day
-
area:gfx bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
InauguralSystems/EigenScript#1684 ·
Maintainers usually reply within 1 day
All issues in InauguralSystems/EigenScript
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
build help wanted new feature
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
AOMediaCodec/SVT-AV1#2516 · 2 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 4 days