extrawurst / gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀
MIT License
17.92k stars 548 forks source link

v0.26.3 installed with cargo-binstall fails to launch #2255

Open gg-kialo opened 1 month ago

gg-kialo commented 1 month ago

Describe the bug With gitui v0.26.3 installed with https://github.com/cargo-bins/cargo-binstall, I can't use gitui in any of my repositories. It fails with an error of:

invalid path
please run gitui inside of a non-bare git repository

when I turn on --logging the log reads:

08:55:46 [ERROR] repo open error: could not stat '${REPO_PATH}/.git/info/grafts': ; class=Os (2)

I have no issues with v0.26.2 installed with cargo-binstall or with v0.26.3 installed with cargo without binstall, built locally, or using the executable from the github release.

To Reproduce Steps to reproduce the behavior:

  1. cargo binstall gitui@0.26.3 --force
  2. cd into a repository
  3. execute gitui
  4. See error
    invalid path
    please run gitui inside of a non-bare git repository

Expected behavior gitui to open normally.

Additional Information

Software version

gitui 0.26.3 (installed with cargo-binstall)

Operating system

Linux 6.5.0-28-generic (ubuntu 23.10)

Compile time information

Environment variables

SHELL=/bin/bash
EDITOR=lvim
GIT_EDITOR=<not set>
VISUAL=<not set>

Command-line

gitui --bugreport 
extrawurst commented 1 month ago

please share the output you get when installing via binstall

gg-kialo commented 1 month ago

Here's my binstall output.

❯ cargo binstall gitui@0.26.3 --force -y
 INFO resolve: Resolving package: 'gitui@=0.26.3'
 INFO resolve: Verified signature for package 'gitui-0.26.3-x86_64-unknown-linux-gnu': timestamp:1717378732 file:gitui-0.26.3-x86_64-unknown-linux-gnu.tar.gz   hashed
 WARN The package gitui v0.26.3 (x86_64-unknown-linux-gnu) has been downloaded from third-party source QuickInstall
 INFO This will install the following binaries:
 INFO   - gitui (gitui -> /home/ggovan/.cargo/bin/gitui)
 INFO Installing binaries...
 INFO Done in 2.239927562s

binstall is v1.6.8

cruessler commented 1 month ago

I can reproduce with Ubuntu 24.04 and am trying to find the root cause.

cruessler commented 1 month ago

I can only reproduce using cargo binstall gitui@0.26.3 --force, but not if I build from source using either cargo install --path . --locked or cargo install --path .

gzsombor commented 1 month ago

I have the same problem, I've tried to run with strace:

newfstatat(AT_FDCWD, "/mnt/nearly2t/projects/rust/iggy/.git/config", {st_mode=S_IFREG|0664, st_size=367, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/zsombor/.gitconfig", {st_mode=S_IFREG|0664, st_size=134, ...}, 0) = 0
newfstatat(AT_FDCWD, "/mnt/nearly2t/projects/rust/iggy/.git/info/grafts", 0x7fff403dba10, 0) = -1 ENOENT (Nincs ilyen fájl vagy könyvtár)
write(2, "invalid path\nplease run gitui in"..., 66invalid path
please run gitui inside of a non-bare git repository
) = 66
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x703e978d7000, 12288)           = 0
exit_group(0)                           = ?

After touch .git/info/grafts I get:

newfstatat(AT_FDCWD, "/mnt/nearly2t/projects/rust/iggy/.git/info/grafts", {st_mode=S_IFREG|0664, st_size=0, ...}, 0) = 0
openat(AT_FDCWD, "/mnt/nearly2t/projects/rust/iggy/.git/info/grafts", O_RDONLY|O_CLOEXEC) = 3
close(3)                                = 0
newfstatat(AT_FDCWD, "/mnt/nearly2t/projects/rust/iggy/.git/shallow", 0x7fff6e9c3b10, 0) = -1 ENOENT (Nincs ilyen fájl vagy könyvtár)
write(2, "invalid path\nplease run gitui in"..., 66invalid path
please run gitui inside of a non-bare git repository
) = 66
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x72f6c5394000, 12288)           = 0
exit_group(0)                           = ?

After touch .git/shallow the app starts up.

Saplyn commented 1 month ago

Same problem if gitui@0.26.3 is install via cargo-binstall, but works fine if installed with cargo install (with or without --locked).

cruessler commented 1 month ago

I had a look at both cargo-binstall’s as well as libgit2’s source, but I didn’t spot anything that seemed obviously related to this issue. Since there is a workaround, my current recommendation would be to wait and see whether this continues to be an issue in the next version. If so, I think it makes sense to invest more time into finding the root cause.

hpodhaisky commented 3 weeks ago

I needed to execute

touch .git/info/grafts
git replace --convert-graft-file

to make gitui start again.

extrawurst commented 3 weeks ago

@hpodhaisky do you have any idea why that is? is there a way to fix that via a PR?

hpodhaisky commented 3 weeks ago

Sorry, I have no idea. I just looked at the strace output. Symptoms as described above: gitui failed after being updated with cargo binstall gitui.