adevinta / maiao

Seamless GitHub PR management from the command-line
MIT License
118 stars 9 forks source link

pass: Experimental keys do not work properly (hang infinitely) #71

Open miguelbernadi opened 1 day ago

miguelbernadi commented 1 day ago

I have tried to use the MAIAO_EXPERIMENTAL_CREDENTIALS=true option locally (downloaded the latest release of maiao beforehand). I have pass installed, so my expectation is that it would try to use pass. Docs do not detail any further setup requirements to pick that source.

In the end, the process hangs indefinitely.

System details:

When I try to run it, I get asked for the username and password. My guess is that they are asked to store initially in the keyring as they were not found already there. After entering them the process just hangs there.

Output of maiao (-v5)

$ git maiao -v5
DEBU[0000] err: <nil>                                    commit-hook path=/home/mbernabe/git/public/go-k8s-toolkit/.git/hooks/commit-msg commit-msg installed=true gitDir=/home/mbernabe/git/public/go-k8s-toolkit/.git
DEBU[0000] finding relevant remote                      
DEBU[0000] dig not find tracking remote. Using default "origin"  branch=
DEBU[0000] finding remote                                branch= headRef=refs/heads/main headSHA=f73775b72a9b6bbaedc8b53f16b79af0fec5e022 remote=origin skipRebase=false topic=
DEBU[0000] using default netrc path                      context="parsing netrc" host=api.github.com
✔ password for api.github.com (usually your Personal Access Token): ****************************************█
^Cpassword for api.github.com (usually your Personal Access Token): ************************
$ 

Output of strace

While waiting for the first input, I started strace on the process

$ ps -A | grep maiao
1550308 pts/5    00:00:00 git-maiao
$ sudo strace -p 1550308
strace: Process 1550308 attached
epoll_pwait(4, [{events=EPOLLOUT, data={u32=2889768680, u64=129861225963240}}], 128, -1, NULL, 0) = 1
epoll_pwait(4, [], 128, 0, NULL, 0)     = 0
epoll_pwait(4, [{events=EPOLLIN|EPOLLOUT, data={u32=2889768680, u64=129861225963240}}], 128, -1, NULL, 0) = 1
futex(0x10e5300, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x10e5218, FUTEX_WAKE_PRIVATE, 1) = 1
recvmsg(3, {msg_name={sa_family=AF_UNIX, sun_path="/run/user/1000/bus"}, msg_namelen=112 => 21, msg_iov=[{iov_base="l\2\1\1R\0\0\0\332)\0\0.\0\0\0", iov_len=16}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 16
recvmsg(3, {msg_name={sa_family=AF_UNIX, sun_path="/run/user/1000/bus"}, msg_namelen=112 => 21, msg_iov=[{iov_base="\6\1s\0\7\0\0\0:1.4488\0\5\1u\0\6\0\0\0\10\1g\0\2vo\0"..., iov_len=48}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 48
recvmsg(3, {msg_name={sa_family=AF_UNIX, sun_path="/run/user/1000/bus"}, msg_namelen=112 => 21, msg_iov=[{iov_base="\1s\0\0\0\0\0\0\0\0\0\0A\0\0\0/org/freedesktop"..., iov_len=82}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 82
futex(0xc000180148, FUTEX_WAKE_PRIVATE, 1) = 1
recvmsg(3, {msg_namelen=112}, MSG_CMSG_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x10e4f48, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x10e4f48, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
epoll_pwait(4, [], 128, 0, NULL, 0)     = 0
futex(0x10e4f48, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
epoll_pwait(4, [], 128, 0, NULL, 0)     = 0
futex(0x10e4f48, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
futex(0x10e4f48, FUTEX_WAIT_PRIVATE, 0, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0
getpid()                                = 1550308
gettid()                                = 1550308
tgkill(1550308, 1550308, SIGINT)        = 0
--- SIGINT {si_signo=SIGINT, si_code=SI_TKILL, si_pid=1550308, si_uid=1000} ---
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER|SA_ONSTACK|SA_RESTART|SA_SIGINFO, sa_restorer=0x761bd3fe51d0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0
getpid()                                = 1550308
gettid()                                = 1550308
tgkill(1550308, 1550308, SIGINT)        = 0
--- SIGINT {si_signo=SIGINT, si_code=SI_TKILL, si_pid=1550308, si_uid=1000} ---
+++ killed by SIGINT +++
miguelbernadi commented 1 day ago

Looking at the strace output, it seems to be trying to contact DBus, but I do not have it wired with the rest of the system, especially not with pass.

I do not think it can connect to DBus at any step. If so, it should fail to connect to the keyrings earlier instead of after requesting credentials. It is missing some setup testing to choose an adequate connection method.