Fixes crash rendering broken gopher maps #128
No reviewers
Labels
No Label
blocked
bug
build
documentation
duplicate
enhancement
finger
gemini
gopher
help wanted
http
in progress
invalid
local
needs-info
non-code
non-functional
non-urgent
question
release
rendering
suggestion
telnet
terminal
urgent
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sloum/bombadillo#128
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix-gopher-crash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The map in question is for:
gopher://dataforge.network
There are some funky things going on with the gophermap. This updates the way bad lines are handled. It will now make empty lines still work and improves handling of improperly formed lines (or lines of just text with only one field). Comparing the new output to lynx there is output parity, which makes me feel good about the change.
Just curious, where did the crash actually occur? Interesting this crash does not show an error message.
I agree it is weird that no error or panic was visible. As best as I was able to tell it had to do with line 138 (in the current master branch) of
gopher/gopher.go
. I really do need to set up logging for this project so I can get better error output in situations like this.If you comment lines 138-144 and build and run with the above listed address it rendered fine. So the issue is definitely in those lines. The adjustment I made worked... but I am still unclear on the exact issue. Their gopher map is messed up in a few places (which Bombadillo should be able to handle).
The areas I focused on:
This check seems unstable. If
line[0]
is""
then this would be a bad reference. So I updated to:Which is a safe option for testing that. However, that alone did not seem to fix the issue. But either way it was a change that should exist so I left it.
I simplified the logic of the surrounding if/else statements a bit and that seemed to solve the problem. There is no logical reason why it should have done so. However, this does seem to provide stable and reliable results. Handling broken pages pretty well.
If you feel like diving into this at all, this has not been merged into
master
so you can visit (gopher://dataforge.network)[gopher://dataforge.network] withmaster
and withdevelop
and check out the differences. If you can find anything I missed I would definitely love to solve this deeper than the current "it works now" solution.I will also open an issue to set up logging and maybe a system new boolean flag to toggle logging on or off?
Great, thanks for the information on this.
I'm happy to take a look. So far, I've created a basic unit test to trigger the issue, and it looks like it is definitely
parseMap()
causing a panic on line 141 (it doesn't look likebuildLink()
is involved though), with a message like this:The key parts are:
and
This is done using vscodium, which has gotests to generate the shell of the unit test (you just fill in a struct), plus a "debug test" button which runs the debugger on that single unit test (which works pretty well).
That might give you a clear idea of what is happening but I'll investigate this further to understand exactly what is happening.
Yeah, that does confirm it is what I was thinking: a bad array access. I am definitely feeling like I should not have rushed that fix through. I see what the issue is and believe I have resolved it. I have a PR open: #130