From nobody@FreeBSD.org  Fri May  2 15:27:33 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 31A612CA
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  2 May 2014 15:27:33 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 1F51014E5
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  2 May 2014 15:27:33 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s42FRWAI089547
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 2 May 2014 15:27:32 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s42FRWMM089535;
	Fri, 2 May 2014 15:27:32 GMT
	(envelope-from nobody)
Message-Id: <201405021527.s42FRWMM089535@cgiserv.freebsd.org>
Date: Fri, 2 May 2014 15:27:32 GMT
From: Dan McGregor <dan.mcgregor@usask.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ssh-copy-id contains a syntax error
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         189246
>Category:       bin
>Synopsis:       ssh-copy-id contains a syntax error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 02 15:30:00 UTC 2014
>Closed-Date:    Sun May 04 02:33:33 UTC 2014
>Last-Modified:  Sun May 04 02:33:33 UTC 2014
>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:
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sun May 4 02:31:44 UTC 2014 
State-Changed-Why:  
committed by eadler in http://svnweb.freebsd.org/base?view=revision&revision=265256 . 

http://www.freebsd.org/cgi/query-pr.cgi?pr=189246 
>Unformatted:
