[Bug 3158] New: ssh-copy-id raises "expr: syntax error" when double-hyphen is passed ("--")
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Mon May 4 07:51:19 AEST 2020
https://bugzilla.mindrot.org/show_bug.cgi?id=3158
Bug ID: 3158
Summary: ssh-copy-id raises "expr: syntax error" when
double-hyphen is passed ("--")
Product: Portable OpenSSH
Version: 8.2p1
Hardware: All
OS: Linux
Status: NEW
Severity: minor
Priority: P5
Component: ssh-copy-id
Assignee: unassigned-bugs at mindrot.org
Reporter: rf at rufflewind.com
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 && {
--
You are receiving this mail because:
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list