Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 1999 04:56:41 +0900 (JST)
From:      dcs@newsguy.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/9397: Loader's parser can't escape characters
Message-ID:  <199901081956.EAA00618@local.ocn.ne.jp>

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


>Number:         9397
>Category:       kern
>Synopsis:       Loader's parser can't escape characters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan  8 12:10:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Daniel C. Sobral
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	Three stage boot loader.

>Description:

	There is no way to escape a character in loader. As a result,
it becomes impossible, for instance, to set the variable PROMPT to it's
default.

>How-To-Repeat:

	UTSL?
	Enter "set prompt=${currdev}" and then "show", in the loader,
just for fun...

>Fix:

	Apply the following two patches. Notice that the parser presently
eats away backslashes. It preserves them in case of quotes, though it then
do nothing with it. The following patches preserve the backslash when it
precedes $ too, and *do* something about it. :-) Escaping other characters
can still be done using \\.


--- sys/boot/common/interp_parse.c	Mon Jan  4 15:39:21 1999
+++ sys/boot/common/interp_parse.c.orig	Mon Jan  4 15:10:28 1999
@@ -100,11 +100,7 @@
     while (*p) {
 	switch (state) {
 	case STR:
-	    if ((*p == '\\') && p[1] ) {
-		p++;
-		PARSE_FAIL(i == (PARSE_BUFSIZE - 1));
-		buf[i++] = *p++;
-	    } else if (isquote(*p)) {
+	    if (isquote(*p)) {
 		quote = quote ? 0 : *p;
 		++p;
 	    }


--- sys/boot/common/interp_backslash.c.orig	Wed Jan  6 05:59:26 1999
+++ sys/boot/common/interp_backslash.c	Wed Jan  6 05:59:36 1999
@@ -11,7 +11,7 @@
  * Jordan K. Hubbard
  * 29 August 1998
  *
- *	$Id: interp_backslash.c,v 1.1 1999/01/05 20:52:32 root Exp $
+ *	$Id: interp_backslash.c,v 1.2 1999/01/05 20:54:09 root Exp root $
  *
  * Routine for doing backslash elimination.
  */
@@ -55,6 +55,12 @@
 	    /* preserve backslashed quotes */
 	    case '\'':
 	    case '"':
+		new_str[i++] = '\\';
+		new_str[i++] = *str++;
+		break;
+
+	    /* preserve backslashed dollars */
+	    case '$':
 		new_str[i++] = '\\';
 		new_str[i++] = *str++;
 		break;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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