Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 2014 15:27:32 GMT
From:      Dan McGregor <dan.mcgregor@usask.ca>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/189246: ssh-copy-id contains a syntax error
Message-ID:  <201405021527.s42FRWMM089535@cgiserv.freebsd.org>
Resent-Message-ID: <201405021530.s42FU0Un049631@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         189246
>Category:       misc
>Synopsis:       ssh-copy-id contains a syntax error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 02 15:30:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Dan McGregor
>Release:        10.0-STABLE
>Organization:
>Environment:
FreeBSD shadrach.dyndns.org 10.0-STABLE FreeBSD 10.0-STABLE #29 r264456: Mon Apr 14 08:00:01 CST 2014     dan@shadrach.dyndns.org:/usr/obj/usr/src/sys/SHADRACH  amd64
>Description:
ssh-copy-id contains a syntax error in the script it sends to the remote end. It certainly affects bash and zsh. It appears like so:

% ssh-copy-id root@beaglebone.local                                                        
zsh:12: parse error near `if'

or with bash:

% ssh-copy-id root@beaglebone.local
/bin/sh: -c: line 11: syntax error near unexpected token `if'
/bin/sh: -c: line 11: `         if [ -x /sbin/restorecon ]; then \'


The tested versions were zsh version 5.0.5 and bash version 4.3.0
>How-To-Repeat:
Have a remote machine with either bash or zsh as /bin/sh
>Fix:
The attached patch fixes it.

Patch attached with submission follows:

Index: usr.bin/ssh-copy-id/ssh-copy-id.sh
===================================================================
--- usr.bin/ssh-copy-id/ssh-copy-id.sh	(révision 265225)
+++ usr.bin/ssh-copy-id/ssh-copy-id.sh	(copie de travail)
@@ -45,7 +45,7 @@
 			if ! grep -sqwF "$key" "$keyfile"; then \
 				printf "$alg $key $comment\n" >> "$keyfile" ; \
 			fi ; \
-		done \
+		done ; \
 		if [ -x /sbin/restorecon ]; then \
 			/sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \
 		fi


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405021527.s42FRWMM089535>