Buggy redirect input in gemini #101
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sloum/bombadillo#101
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
I have found some buggy input behavior. I had experienced something like this in one of the file write modules and took it out because I couldnt find the source of the problem. This was working correctly before but seems to just freak out now.
To replicate:
gemini://gemini.circumlunar.space:1965/~sloum
gemini://gemini.circumlunar.space:1965/~sloum/
(it wants to redirect to add the terminal slash)I would love some help on this as I have been baffled by this before and I'm still on spotty internet out in the woods. I'm not sure if this should hold up 2.0.0. or not.
Let me know your thoughts. If you are unable to replicate the issue it may be unique to my system for some reason.
If you keep pressing
y
it will eventually register. Pressing anything else will also eventually register asno
(do not follow the redirect).Ok. I think I have it figured out. We (I put them there, so me) are using a goroutine for
c.Visit(u)
on line820
of the client. That means that we loop to another input loop for the regular input and are also asking for input from within the goroutine. MakingVisit
a blocking call should resolve the issue. I cant test it this second but will try to test it in the morning.There are some other goroutines in the mix. If any of the possible calls down the goroutine paths would ask for input we probably cannot run them as goroutines without a channel. That is very doable but makes things a little more complicated. I think if the above fix works, then I would prefer just doing blocking calls for those calls for the time being. We can look into channels for a minor update later.
Feel free to skip looking into this one for the moment if you like.
Funny, pressing
y
in rapid succession will allow you to continue. Rapidly, not slowly.Just to clarify, making this a blocking call means removing the word from line 820 of client.go. This seems to fix the issue without a noticeable impact to performance.
I had a look and couldn't see anything else that might conflict. It's only cui.Getch() and cui.GetLine() that do a reader on stdin, and I don't think they are used in other goroutines.
Do you have an idea of how it might be fixed longer term? I'm having trouble understanding how it might work.
The idea I had for a longer term fix is to make sure only one process tries to read from std-in at one time. To do so, a channel would need to be set up. Before any attempt to read from std-in the channel would need to be checked, if there was a token stating true or open or something or a 1, whatever, the the read can take place (reading the value should pop it off the channel so any subsequent attempts shouldn't see a value yet). When something gets the go-ahead token they do their read and then send a go-ahead token tot he channel when done. Anything wanting to read from std-in while there is nothing on the channel will loop and keep reading the channel until they get a go-ahead token (whatever that may be).
That is, at least in the abstract, how I think it could work. It, in my head, works similar to ownership in Rust, except in our case receiving the token from the channel transfers ownership of std-in.
Closed, for now, by #102