Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/bin/sh Pull up the following revisions(s) (requested by d...
details: https://anonhg.NetBSD.org/src/rev/a80643399b05
branches: netbsd-6
changeset: 775630:a80643399b05
user: sborrill <sborrill%NetBSD.org@localhost>
date: Sat Feb 02 15:43:27 2013 +0000
description:
Pull up the following revisions(s) (requested by dsl in ticket #773):
bin/sh/expand.c: revision 1.88
bin/sh/expand.h: revision 1.19
Fix the expansion of "$(foo-$bar}" so that IFS isn't applied when
expanding $bar. Should fix PR bin/47361
diffstat:
bin/sh/expand.c | 23 ++++++++++++++++++-----
bin/sh/expand.h | 3 ++-
2 files changed, 20 insertions(+), 6 deletions(-)
diffs (68 lines):
diff -r ec7e8142b741 -r a80643399b05 bin/sh/expand.c
--- a/bin/sh/expand.c Sat Jan 26 21:36:05 2013 +0000
+++ b/bin/sh/expand.c Sat Feb 02 15:43:27 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.c,v 1.86 2011/08/31 16:24:54 plunky Exp $ */
+/* $NetBSD: expand.c,v 1.86.4.1 2013/02/02 15:43:27 sborrill 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.86 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: expand.c,v 1.86.4.1 2013/02/02 15:43:27 sborrill Exp $");
#endif
#endif /* not lint */
@@ -247,7 +247,7 @@
break;
default:
STPUTC(c, expdest);
- if (flag & EXP_IFS_SPLIT & ifs_split && strchr(ifs, c) != NULL) {
+ if (flag & ifs_split && strchr(ifs, c) != NULL) {
/* We need to get the output split here... */
recordregion(expdest - stackblock() - 1,
expdest - stackblock(), 0);
@@ -702,8 +702,21 @@
}
- apply_ifs = ((varflags & VSQUOTE) == 0 ||
- (*var == '@' && shellparam.nparam != 1));
+ if (flag & EXP_IN_QUOTES)
+ apply_ifs = 0;
+ else if (varflags & VSQUOTE) {
+ if (*var == '@' && shellparam.nparam != 1)
+ apply_ifs = 1;
+ else {
+ /*
+ * Mark so that we don't apply IFS if we recurse through
+ * here expanding $bar from "${foo-$bar}".
+ */
+ flag |= EXP_IN_QUOTES;
+ apply_ifs = 0;
+ }
+ } else
+ apply_ifs = 1;
switch (subtype) {
case VSLENGTH:
diff -r ec7e8142b741 -r a80643399b05 bin/sh/expand.h
--- a/bin/sh/expand.h Sat Jan 26 21:36:05 2013 +0000
+++ b/bin/sh/expand.h Sat Feb 02 15:43:27 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.h,v 1.18 2011/06/18 21:18:46 christos Exp $ */
+/* $NetBSD: expand.h,v 1.18.4.1 2013/02/02 15:43:27 sborrill Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -56,6 +56,7 @@
#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */
#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */
#define EXP_IFS_SPLIT 0x20 /* need to record arguments for ifs breakup */
+#define EXP_IN_QUOTES 0x40 /* don't set EXP_IFS_SPLIT again */
union node;
Home |
Main Index |
Thread Index |
Old Index