Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh PR bin/51027 - fix the parsing of references to shell...



details:   https://anonhg.NetBSD.org/src/rev/76d2f98bf588
branches:  trunk
changeset: 814605:76d2f98bf588
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 31 16:12:52 2016 +0000

description:
PR bin/51027 - fix the parsing of references to shell parameters
when given without braces (ie: $2 etc).  Only the first 9 shell
parameters ($1 .. $9) and the special parameter ($0) can be
referenced this way, $10 is ${1}0 not ${10}.   Make it so.
This bug brought to notice by Sven Mascheck's web pages which
discuss (among other things) the history of this (and other ash
based) shells .. see http://www.in-ulm.de/~mascheck/ (from kre@)

diffstat:

 bin/sh/parser.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r d51a958e32a5 -r 76d2f98bf588 bin/sh/parser.c
--- a/bin/sh/parser.c   Thu Mar 31 16:12:09 2016 +0000
+++ b/bin/sh/parser.c   Thu Mar 31 16:12:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $    */
+/*     $NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c   8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1742,7 +1742,7 @@
                        do {
                                USTPUTC(c, out);
                                c = pgetc();
-                       } while (is_digit(c));
+                       } while (subtype != VSNORMAL && is_digit(c));
                }
                else if (is_special(c)) {
                        USTPUTC(c, out);



Home | Main Index | Thread Index | Old Index