| Summary: | ssh-copy-id raises "expr: syntax error" when double-hyphen is passed ("--") | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | rf |
| Component: | ssh-copy-id | Assignee: | Assigned to nobody <unassigned-bugs> |
| Status: | CLOSED FIXED | ||
| Severity: | minor | CC: | phil |
| Priority: | P5 | ||
| Version: | 8.2p1 | ||
| Hardware: | All | ||
| OS: | Linux | ||
ssh-copy-id has switched to using getopts for this, rather than the previous hand-rolled option handling, so I beleive that once that version is included in openssh this problem will be solved. Perhaps you'd be so kind as to check that -- you can find the latest version here: https://gitlab.com/phil_hands/ssh-copy-id Cheers, Phil. The issue appears to be fixe din the new ssh-copy-id. Thanks! close bugs that were resolved in OpenSSH 8.5 release cycle |
Assuming an identity file exists at ~/.ssh/id_rsa.pub, the following command, which adds a preventative double-dash ("--"): ssh-copy-id -i ~/.ssh/id_rsa.pub -- remote-server will result in the following error: expr: syntax error: unexpected argument ā[-]iā The error is non-fatal, but it may be confusing to users. I suspect this is caused by line 110: [ "${SEEN_OPT_I}" ] && expr "$1" : "[-]i" >/dev/null && { Here, "$1" is passed to expr without being validated, so if $1 is "--" as shown in the command above, this will confuse expr. I think expr should be called with "--" to prevent this: [ "${SEEN_OPT_I}" ] && expr -- "$1" : "[-]i" >/dev/null && {