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/43469 - correctly handle quoting of the patter...
details: https://anonhg.NetBSD.org/src/rev/ed819bd70418
branches: trunk
changeset: 343716:ed819bd70418
user: christos <christos%NetBSD.org@localhost>
date: Mon Feb 22 20:02:00 2016 +0000
description:
PR bin/43469 - correctly handle quoting of the pattern part of ${var%pat}
type expansions. (from kre)
diffstat:
bin/sh/expand.c | 6 +++---
bin/sh/parser.c | 6 ++++--
bin/sh/parser.h | 3 ++-
3 files changed, 9 insertions(+), 6 deletions(-)
diffs (71 lines):
diff -r 1e980a46260e -r ed819bd70418 bin/sh/expand.c
--- a/bin/sh/expand.c Mon Feb 22 19:53:16 2016 +0000
+++ b/bin/sh/expand.c Mon Feb 22 20:02:00 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.c,v 1.93 2015/08/27 07:46:47 christos Exp $ */
+/* $NetBSD: expand.c,v 1.94 2016/02/22 20:02:00 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
-__RCSID("$NetBSD: expand.c,v 1.93 2015/08/27 07:46:47 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.94 2016/02/22 20:02:00 christos Exp $");
#endif
#endif /* not lint */
@@ -511,7 +511,7 @@
case VSTRIMLEFTMAX:
case VSTRIMRIGHT:
case VSTRIMRIGHTMAX:
- how = (varflags & VSQUOTE) ? 0 : EXP_CASE;
+ how = (varflags & (VSQUOTE|VSPATQ)) == VSQUOTE ? 0 : EXP_CASE;
break;
default:
how = 0;
diff -r 1e980a46260e -r ed819bd70418 bin/sh/parser.c
--- a/bin/sh/parser.c Mon Feb 22 19:53:16 2016 +0000
+++ b/bin/sh/parser.c Mon Feb 22 20:02:00 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.c,v 1.97 2016/02/22 19:42:46 christos Exp $ */
+/* $NetBSD: parser.c,v 1.98 2016/02/22 20:02:00 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.97 2016/02/22 19:42:46 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.98 2016/02/22 20:02:00 christos Exp $");
#endif
#endif /* not lint */
@@ -1517,6 +1517,8 @@
}
if (ISDBLQUOTE() || arinest)
flags |= VSQUOTE;
+ if (subtype >= VSTRIMLEFT && subtype <= VSTRIMRIGHTMAX)
+ flags |= VSPATQ;
*(stackblock() + typeloc) = subtype | flags;
if (subtype != VSNORMAL) {
TS_PUSH();
diff -r 1e980a46260e -r ed819bd70418 bin/sh/parser.h
--- a/bin/sh/parser.h Mon Feb 22 19:53:16 2016 +0000
+++ b/bin/sh/parser.h Mon Feb 22 20:02:00 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.h,v 1.18 2013/10/02 19:52:58 christos Exp $ */
+/* $NetBSD: parser.h,v 1.19 2016/02/22 20:02:00 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -53,6 +53,7 @@
#define VSNUL 0x10 /* colon--treat the empty string as unset */
#define VSLINENO 0x20 /* expansion of $LINENO, the line number
follows immediately */
+#define VSPATQ 0x40 /* ensure correct pattern quoting in ${x#pat} */
#define VSQUOTE 0x80 /* inside double quotes--suppress splitting */
/* values of VSTYPE field */
Home |
Main Index |
Thread Index |
Old Index