From owner-svn-src-all@FreeBSD.ORG Sun Nov 10 23:00:40 2013 Return-Path: Delivered-To: svn-src-all@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 ESMTP id AEE12E9C; Sun, 10 Nov 2013 23:00:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B0A527EA; Sun, 10 Nov 2013 23:00:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAAN0eCc078943; Sun, 10 Nov 2013 23:00:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAAN0eAH078941; Sun, 10 Nov 2013 23:00:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201311102300.rAAN0eAH078941@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 10 Nov 2013 23:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257929 - in head: bin/sh tools/regression/bin/sh/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2013 23:00:40 -0000 Author: jilles Date: Sun Nov 10 23:00:39 2013 New Revision: 257929 URL: http://svnweb.freebsd.org/changeset/base/257929 Log: sh: Properly quote alias output from command -v. An alias should be printed by command -v as a command line; therefore, make the alias definition suitable for re-input to the shell. Added: head/tools/regression/bin/sh/builtins/command12.0 (contents, props changed) Modified: head/bin/sh/exec.c Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sun Nov 10 22:42:56 2013 (r257928) +++ head/bin/sh/exec.c Sun Nov 10 23:00:39 2013 (r257929) @@ -672,9 +672,11 @@ typecmd_impl(int argc, char **argv, int /* Then look at the aliases */ if ((ap = lookupalias(argv[i], 1)) != NULL) { - if (cmd == TYPECMD_SMALLV) - out1fmt("alias %s='%s'\n", argv[i], ap->val); - else + if (cmd == TYPECMD_SMALLV) { + out1fmt("alias %s=", argv[i]); + out1qstr(ap->val); + outcslow('\n', out1); + } else out1fmt("%s is an alias for %s\n", argv[i], ap->val); continue; Added: head/tools/regression/bin/sh/builtins/command12.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/command12.0 Sun Nov 10 23:00:39 2013 (r257929) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +alias aa=echo\ \'\"\' +cmd=$(command -v aa) +alias aa=echo\ bad +eval "$cmd" +[ "$(eval aa)" = \" ]