Argument escaping of resurrected programs launched with arguments
This likely happens with any resurrected command that was ran with quoted strings as arguments that contain spaces. So I figured you should be made aware.
I noticed in the error message I was given that it was printing out:
vim -u /nix/store/liy8rn8p5kk9x5661033nvcpwpqzp34h-init.lua --cmd lua vim.g.loaded_node_provider=0;vim.g.loaded_perl_provider=0;vim.g.loaded_python_provider=0;vim.g.python3_host_prog='/nix/store/darvrfhzqs3482gf4316w638gq07x5c0-neovim-0.10.2-myHomeModuleNvim/bin/myHomeModuleNvim-python3';vim.g.ruby_host_prog='/nix/store/darvrfhzqs3482gf4316w638gq07x5c0-neovim-0.10.2-myHomeModuleNvim/bin/myHomeModuleNvim-ruby'; dofile([[/nix/store/dwc3jk10ki03nazyjd463690awpmkl0q-setup.lua]]) default.nix
Followed by
bash: syntax error near unexpected token `[[/nix/store/dwc3jk10ki03nazyjd463690awpmkl0q-setup.lua]]'
It appears that it removed the quotes around the --cmd and threw an error because of it! Or possibly did not escape the ' within the string correctly
It should look like this with the quotes
vim -u /nix/store/liy8rn8p5kk9x5661033nvcpwpqzp34h-init.lua --cmd "lua vim.g.loaded_node_provider=0;vim.g.loaded_perl_provider=0;vim.g.loaded_python_provider=0;vim.g.python3_host_prog='/nix/store/darvrfhzqs3482gf4316w638gq07x5c0-neovim-0.10.2-myHomeModuleNvim/bin/myHomeModuleNvim-python3';vim.g.ruby_host_prog='/nix/store/darvrfhzqs3482gf4316w638gq07x5c0-neovim-0.10.2-myHomeModuleNvim/bin/myHomeModuleNvim-ruby'; dofile([[/nix/store/dwc3jk10ki03nazyjd463690awpmkl0q-setup.lua]])" default.nix
It seems likely that the arguments being restored are being directly printed from argv[whatever] straight to a string?
Those should be escaped and quoted properly before the command is ran again.
Nix will run into this more often, because we often wrap our programs with scripts that launch them with specific arguments.
But this should be a widely applicable issue, that anyone could run into when resurrecting programs started with arguments including a quoted string with spaces in it.
It seems this issue may be related, there are probably others too, but they were hard to find when I went to post this because they are not as clear about what they think the exact problem may be
https://github.com/tmux-plugins/tmux-resurrect/issues/508
It seems this issue may be related, there are probably others too, but they were hard to find when I went to post this because they are not as clear about what they think the exact problem may be
hey thanks for the suggestion. just seeing the post today. i updated my command to not use quoted strings and tmux-resurrect still doesnt save it properly for me. oh well.
here is the updated command: tput civis ; ssh -t [email protected] watch -ct -n60 some_bash_script
it also doesnt look like much activity from maintainers in this repo
Hmmm
There may be other reasons why your command was failing in addition, maybe it is stopping at the semicolon, honestly I have no idea I'm sorry, I am not a tmux_resurrect user.
All I can say for sure is when I updated the command my project used to no longer have reliance on quotes for argument grouping, the user reported that it was fixed for them, and that the problem made sense based on the tmux-resurrect code I looked at and the error messages I was getting when I tried it to troubleshoot the issue.