wouterdebie / i2cssh

csshX like ssh tool for iTerm2
MIT License
547 stars 68 forks source link

Passing an 'extra' key/value parameter whose value contains '=' fails #122

Closed bruiiser closed 1 year ago

bruiiser commented 1 year ago

Describe the bug When passing an 'extra' parameter whose value also contains an '=' i2cssh fails with the following error:

  File "/opt/homebrew/bin/i2cssh", line 348, in create_ssh_prefix
    k, v = e.split("=")
    ^^^^
ValueError: too many values to unpack (expected 2)

My config

  1. Include your ~/.i2csshrc (if you have one)
  2. The command line you use to run i2cssh
/opt/homebrew/bin/i2cssh --profile iterm_profile --login my_username --forward-agent -Xi=path_to_private_key -Xo=\'IdentitiesOnly=yes\' -Xo=\'StrictHostKeyChecking=no\' -XJ=some_gateway --file /tmp/i2csshx-hosts.txt

i2cssh fails to parse the parameters whose values contain an '=', like the '-Xo' parameters do Expected behavior A clear and concise description of what you expected to happen.

I would expect this line to parse correctly, like it did with the ruby version of i2cssh

Screenshots or stack traces If applicable, add screenshots or stack traces to help explain your problem.

Additional context Add any other context about the problem here.

The problem as indicated at line 348 of i2cssh is that the split command is being greedy and finding multiple '=' split characters. Changing this line to k, v = e.split("=", 1) solved the problem

wouterdebie commented 1 year ago

Thanks for the bug report!