Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Dec 2009 15:29:18 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200988 - head/bin/sh
Message-ID:  <200912251529.nBPFTIxS064735@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri Dec 25 15:29:18 2009
New Revision: 200988
URL: http://svn.freebsd.org/changeset/base/200988

Log:
  sh: Do not consider a tilde-prefix with expansions in it.
  
  That is, do not do tilde expansion if any of the CTL* bytes (\201-\210), not
  only CTLESC and CTLQUOTEMARK, are encountered. Such an expansion would look
  up a user name with sh's internal representation.
  
  The parser does not currently distinguish between backslashed and
  unbackslashed \201-\210, so tilde expansion of user names with these bytes
  in them is not so easy to fix.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Fri Dec 25 15:03:05 2009	(r200987)
+++ head/bin/sh/expand.c	Fri Dec 25 15:29:18 2009	(r200988)
@@ -271,8 +271,13 @@ exptilde(char *p, int flag)
 
 	while ((c = *p) != '\0') {
 		switch(c) {
-		case CTLESC:
-			return (startp);
+		case CTLESC: /* This means CTL* are always considered quoted. */
+		case CTLVAR:
+		case CTLENDVAR:
+		case CTLBACKQ:
+		case CTLBACKQ | CTLQUOTE:
+		case CTLARI:
+		case CTLENDARI:
 		case CTLQUOTEMARK:
 			return (startp);
 		case ':':



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