Closed failable closed 8 months ago
This looks like a cryptic message from libgit2.
What does it say when you
RUST_BACKTRACE=1 cargo run
?
Seems to get the same output..
Been on rustc 1.76 (stable), switched to 1.78 (nightly) and I got these warnings as well. But I don't experience the same issue on Fedora. Should add some logging options to Gitu. Best I can do here is guess.
Thank you for reporting it!
I've been banging away at this, and the problem is that Duration::MAX
is too large for the select(2)
syscall timeout value (at least on macOS). select()
gets called in the main loop via event::poll
: https://github.com/altsem/gitu/blob/9d601249f7eff2ddbfd0f58a98af1204b3a876c1/src/lib.rs#L218-L226
I think that this call to event::poll()
is unnecessary, because giving it a maximum, effectively infinite timeout, makes it blocking, just like event::read()
. Can the main loop just omit the if (poll) then continue
condition and block on event::read()
(delete lines 219-222)? I don't see any work that is currently being performed between calls to poll
, anyway.
Note: I found that the syscall call was the source of the problem by stepping through with a debugger, and I figured out the maximum value for the timeout to select(2)
on macOS with the following sloppy C code: https://gist.github.com/overhacked/0b041af7994c06f9b6837876083deb72
I meant to add, commenting out
if !event::poll(std::time::Duration::MAX)? {
continue;
}
gets rid of the error, and everything else in the TUI seems to work fine.
Agreed it looks entirely unnecessary. There's no need to draw unless there's an event. :+1:
I merged a fix for it for now, reckon i need to see over PR permissions or something so others can contribute more easily. Assuming this fixes it and closing the issue. Thanks guys! :)
When I try to run
gitu
, I get the below error.macOS 14.2.1 (23C71)
cargo install --git https://github.com/altsem/gitu.git --locked
# 6196acc216f5efb774a775b98856d241ce377998