saulpw / visidata

A terminal spreadsheet multitool for discovering and arranging data
http://visidata.org
GNU General Public License v3.0
7.53k stars 274 forks source link

[BUG] Opening in interactive shell using `xdg-open` yields `unexpected EOF` #2413

Open LnLcFlx opened 1 month ago

LnLcFlx commented 1 month ago

Small description xdg-open file.csv inside an interactive bash shell gives

%f': unexpected EOF while looking for matching `''

and exit code 1.

Expected result Using xdg-open outside a terminal (e.g. a script) it successfully opens a new terminal and visidata inside of it.

Steps to reproduce

  1. set visidata.desktop as default app for some mimetype e.g. text/csv (e.g. in ~/.config/mimeapps.list)
  2. xdg-open file.csv

Additional context

This is probably due to some string escape problem in the line

Exec=bash -i -c 'vd %f'

in visidata.desktop

midichef commented 4 weeks ago

Can you see if it works if you change that line in visidata.desktop to: Exec=vd %F

That's two changes: get rid of bash, and then make %f uppercase. %F is a list of files, according to documentation. I would expect it is more versatile than the lowercase %f that only handles one file.

I'd test it myself, but I can't figure out how to get my system to use visidata.desktop. I've run into a bit too much trouble trying to get xdg-mime default to work.

LnLcFlx commented 4 weeks ago

Can confirm this work (just having Exec=vd %F).

midichef commented 4 weeks ago

Thank you, I will submit the change.

midichef commented 4 weeks ago

@anjakefala I just looked into the history of the .desktop file, that the current configuration worked for you in #1738. Can you check whether the simpler version works for you: Exec=vd %F? I based it on vim's .desktop file.

In particular, does it work for filenames that have spaces in the middle, and for opening multiple files at the same time?