Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy hash freeze gitui #1497

Closed
Fbrisset opened this issue Jan 6, 2023 · 12 comments · Fixed by #1547
Closed

Copy hash freeze gitui #1497

Fbrisset opened this issue Jan 6, 2023 · 12 comments · Fixed by #1547
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@Fbrisset
Copy link

Fbrisset commented Jan 6, 2023

Describe the bug
When I copy the hash of a commit on gitui. It crashes.
But it copies the hash well.

To Reproduce
Steps to reproduce the behavior:

  1. Open gitui
  2. go to log tab
  3. Press y
  4. and gitui freeze

Context (please complete the following information):

  • Debian 11, kernel 5.10.0-20-amd64
  • gnome 3.38 (Wayland)
  • GitUI Version : 0.22.1
  • Rust version: 1.65.0
  • wl-clipboard : 2.0.0
@Fbrisset Fbrisset added the bug Something isn't working label Jan 6, 2023
@extrawurst
Copy link
Owner

please share the log after the freeze

@extrawurst extrawurst added the help wanted Extra attention is needed label Jan 8, 2023
@Fbrisset
Copy link
Author

Fbrisset commented Jan 8, 2023

When i write gitui -l and I reproduce the bug.
Gitui don't create log file and just freeze to infinity

@Gnurou
Copy link

Gnurou commented Jan 10, 2023

I can see this as well and tried to look at what happens using gdb. When I copy the hash gdb displays the following:

[Detaching after vfork from child process 2735066]

gitui then freezes. If I dump the stack trace it seems like the main thread is waiting for a read:

(gdb) bt
#0  __GI___libc_read (nbytes=32, buf=0x560534b07f30, fd=13) at ../sysdeps/unix/sysv/linux/read.c:26
#1  __GI___libc_read (fd=13, buf=0x560534b07f30, nbytes=32) at ../sysdeps/unix/sysv/linux/read.c:24
#2  0x00005605336a8f3a in std::sys::unix::fd::FileDesc::read () at library/std/src/sys/unix/fd.rs:79
#3  std::sys::unix::pipe::AnonPipe::read () at library/std/src/sys/unix/pipe.rs:49
#4  std::process::{impl#16}::read () at library/std/src/process.rs:415
#5  std::io::Read::read_buf::{closure#0}<std::process::ChildStderr> () at library/std/src/io/mod.rs:812
#6  std::io::default_read_buf<std::io::Read::read_buf::{closure_env#0}<std::process::ChildStderr>> () at library/std/src/io/mod.rs:468
#7  std::io::Read::read_buf<std::process::ChildStderr> () at library/std/src/io/mod.rs:812
#8  std::io::default_read_to_end<std::process::ChildStderr> () at library/std/src/io/mod.rs:372
#9  std::io::Read::read_to_end<std::process::ChildStderr> () at library/std/src/io/mod.rs:703
#10 std::process::Child::wait_with_output () at library/std/src/process.rs:1982
#11 0x00005605335007ec in gitui::clipboard::exec_copy_with_args ()
#12 0x0000560533500c79 in gitui::clipboard::copy_string ()
#13 0x000056053353bd9c in <gitui::tabs::revlog::Revlog as gitui::components::Component>::event ()
#14 0x000056053352ac8a in gitui::components::event_pump ()
#15 0x000056053354c612 in gitui::run_app ()
#16 0x00005605335490e1 in gitui::main ()
#17 0x00005605334b8c68 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#18 0x000056053355b313 in main ()

Without having looked at the code, I'd guess that maybe the child process invoked to copy to the clipboard crashed or did not run and the main thread is waiting for its status or output with a blocking read that never returns?

@extrawurst
Copy link
Owner

I am unable to reproduce this, would need help figuring that one out or how to reproduce on a Mac or in some docker container. volunteers?

@kbaikov
Copy link

kbaikov commented Jan 29, 2023

Hallo @extrawurst

The reproduction is straightforward.

  • Run any container sudo docker run -ti --rm archlinux /bin/bash
  • install gitui and git
pacman -Sy
pacman -S git gitui
  • configure git with some global setting, init a repo, add some commit.
git config --global user.email "asdf@asdf.com"
git config --global user.name "asdf"
git init
git commit -m "test message" --allow-empty
  • And as issue desctiption says: run gitui, switch to logs tab and press y.

@quentin-bettoum
Copy link

quentin-bettoum commented Jan 29, 2023

Hello,

I think the problem only happens when xclip is installed.

  • If you only have xsel installed (without xclip), the copy works.

  • If you have xclip installed, with or without xsel, it freezes.

  • If you have neither of xclip or xsel installed, you have this message:

Failed to copy text
`"xsel"`: No such file or directory (os error 2)

@extrawurst
Copy link
Owner

Run any container sudo docker run -ti --rm archlinux /bin/bash

unfortunately does not work on arm64 mac :(

docker: no matching manifest for linux/arm64/v8 in the manifest list entries

@AnonymouX47
Copy link

AnonymouX47 commented Feb 11, 2023

@quentin-bettoum Uninstalling xclip worked for me. Thanks.

@extrawurst, any ideas as to why having xclip installed causes this? Does gitui also try to use xclip?

@extrawurst
Copy link
Owner

@AnonymouX47 yeah on unix systems it tries to use xclip, if that is not found it uses xsel checkout cad40d1 for when this was introduced

@kbaikov
Copy link

kbaikov commented Feb 11, 2023

Is it possible to update Readme/documentation to mention this xclip/xsel problem on linux systems?

Or better yet, use some rust crate that deals with clipboard?

@AnonymouX47
Copy link

@extrawurst I see, thanks.

@extrawurst
Copy link
Owner

related: #1586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants