gitui icon indicating copy to clipboard operation
gitui copied to clipboard

v0.26.3 installed with cargo-binstall fails to launch

Open gg-kialo opened this issue 1 year ago • 10 comments

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 [email protected] --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

  • Profile: release
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Environment variables

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

Command-line

gitui --bugreport 

gg-kialo avatar Jun 03 '24 09:06 gg-kialo

please share the output you get when installing via binstall

extrawurst avatar Jun 03 '24 11:06 extrawurst

Here's my binstall output.

❯ cargo binstall [email protected] --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

gg-kialo avatar Jun 03 '24 11:06 gg-kialo

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

cruessler avatar Jun 03 '24 13:06 cruessler

I can only reproduce using cargo binstall [email protected] --force, but not if I build from source using either cargo install --path . --locked or cargo install --path .

cruessler avatar Jun 03 '24 14:06 cruessler

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.

gzsombor avatar Jun 03 '24 19:06 gzsombor

Same problem if [email protected] is install via cargo-binstall, but works fine if installed with cargo install (with or without --locked).

  • OS: Ubuntu 22.04 jammy
  • Cargo: Version 1.78.0

Saplyn avatar Jun 05 '24 02:06 Saplyn

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.

cruessler avatar Jun 05 '24 15:06 cruessler

I needed to execute

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

to make gitui start again.

hpodhaisky avatar Jun 27 '24 10:06 hpodhaisky

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

extrawurst avatar Jun 27 '24 10:06 extrawurst

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.

hpodhaisky avatar Jun 27 '24 10:06 hpodhaisky

same issue.

v0.26.3

maybe related to https://libgit2.org/docs/reference/main/repository/git_repository_open_ext.html ?

https://github.com/extrawurst/gitui/blob/181ddc5f3fa416fcc829f9e07bb5cfaed21f1eed/asyncgit/src/sync/utils.rs#L28

it try to read .git/info/grafts

ttys3 avatar Dec 11 '24 03:12 ttys3

I just installed gitui 0.27.0 using cargo binstall and it worked (as opposed to 0.26.3 which still failed).

❯ gitui --version
gitui nightly 2025-01-15 ()

cruessler avatar Mar 13 '25 12:03 cruessler

Thanks for testing. Will close then

extrawurst avatar Mar 13 '25 13:03 extrawurst