svn commit: r200988 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Fri Dec 25 15:29:18 UTC 2009


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 ':':


More information about the svn-src-head mailing list