coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

COQnow fails in tmux after upgrading to Fedora 39

Open vincenzocaputo opened this issue 1 year ago • 3 comments

After upgrading to Fedora 39, coq_nvim cannot be started in tmux, as the following error is returned:

not enough values to unpack (expected 7, got 1)                                                                                                                                                                                               
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/.vars/runtime/lib64/python3.10/site-packages/pynvim_pp/logging.py", line 31, in suppress_and_log                                                                                       
    yield None                                                                                                                                                                                                                                
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/coq/clients/tmux/worker.py", line 41, in _poll                                                                                                                                         
    await self.periodical()                                                                                                                                                                                                                   
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/coq/clients/tmux/worker.py", line 49, in periodical                                                                                                                                    
    current, panes = await snapshot(                                                                                                                                                                                                          
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/coq/tmux/parse.py", line 114, in snapshot                                                                                                                                              
    shots = await gather(*(_screenshot(tmux, pane=pane) for pane in panes))                                                                                                                                                                   
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/coq/tmux/parse.py", line 80, in _panes                                                                                                                                                 
  File "/home/vincenzo/.local/share/nvim/lazy/coq_nvim/coq/tmux/parse.py", line 60, in cont                                                                                                                                                   
    session,

I took a look at the worker.py and parse.py and I figured out that the issue stems from the splitting of the output of the systemd-run command:

https://github.com/ms-jpq/coq_nvim/blob/d4a58fa7ab20c928f88e416b3fcf6ada965bf314/coq/tmux/parse.py#L57-L67

Actually, the output of the command is something like this $0\037%0\0370\0370\037nvim\0370\037fedora, which cannot be splitted using \x1f as separator.

Workaround

I solved this issue, at least on my system, by encoding the command output to bytes using UTF-8, and then decoding it back into a Unicode string, as below

def cont() -> Iterator[Pane]:
    for line in decode(proc.stdout).encode('utf-8').decode('unicode_escape').strip().splitlines():
        (
            session,
            pane_id,
            session_name,
            window_index,
            window_name,
            pane_index,
            pane_title,
        ) = line.split(_SEP)

vincenzocaputo avatar Nov 12 '23 11:11 vincenzocaputo

Having the same problem

ntnz avatar Nov 22 '23 04:11 ntnz

For me it does not even start without tmux. I am using fedora 39. I get the same error:

not enough values to unpack (expected 7, got 1)
Traceback (most recent call last):
  File "/home/jab/.local/share/nvim/lazy/coq_nvim/.vars/runtime/lib64/python3.12/site-packages/pynvim_pp/logging.py", line 31, in suppress_and_log
    yield None
  File "/home/jab/.local/share/nvim/lazy/coq_nvim/coq/clients/tmux/worker.py", line 41, in _poll
    await self.periodical()
  File "/home/jab/.local/share/nvim/lazy/coq_nvim/coq/clients/tmux/worker.py", line 49, in periodical
    current, panes = await snapshot(
                     ^^^^^^^^^^^^^^^
  File "/home/jab/.local/share/nvim/lazy/coq_nvim/coq/tmux/parse.py", line 113, in snapshot
    panes = await _panes(tmux, all_sessions=all_sessions)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jab/.local/share/nvim/lazy/coq_nvim/coq/tmux/parse.py", line 79, in _panes
    return tuple(cont())
           ^^^^^^^^^^^^^

thisisjab avatar Dec 22 '23 19:12 thisisjab

@vincenzocaputo Thank you! I was having the same problem. Your workaround works for me.

tdan avatar Jan 14 '24 22:01 tdan