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

Fix stack popping logic in Raku lexer #966

Closed
wants to merge 1 commit into from

Conversation

donaldh
Copy link

@donaldh donaldh commented May 22, 2024

This fixes an array index bounds error.

This fixes an array index bounds error.

Signed-off-by: Donald Hunter <[email protected]>
@alecthomas
Copy link
Owner

This fails the tests for some reason.

@CIAvash
Copy link
Contributor

CIAvash commented Jun 4, 2024

@donaldh is this fixing a particular bug? Because I think it would be better if the bug gets added as a test. It's possible the issue is somewhere else.

@donaldh
Copy link
Author

donaldh commented Jun 4, 2024

It's been a while since this issue first arose but here is some quick info. When I run the latest hugo from brew on my site:

hugo v0.125.7+extended darwin/amd64 BuildDate=2024-05-08T14:46:24Z VendorInfo=brew

ERROR Could not render org: could not write output: runtime error: index out of range [-1]. Using unrendered content.

I will need to patch hugo to output file and line info to narrow down what triggers this.

@donaldh
Copy link
Author

donaldh commented Jun 4, 2024

Now that I have added filenames to the hugo logging, I am getting multiple errors and it's different files each run. That suggests it's racy and there's some shared state between goroutines. When I set HUGO_NUMWORKERMULTIPLIER=1 to serialise the hugo build, I no longer see the error.

Apologies for the noise, it is an issue somewhere else, though I'm not sure if the bug is in chroma, go-org or hugo.

Looking back at the change I made, moving the pop operation was obviously the wrong thing to do. However an array bounds error will happen if the stack length == 1 when popRule() is called. Perhaps this should never happen, but maybe the condition should be if ok && len(stack) > 1 {

@CIAvash
Copy link
Contributor

CIAvash commented Jun 5, 2024

Yeah, probably.

@donaldh donaldh closed this Jul 17, 2024
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 this pull request may close these issues.

3 participants