fix here string parsing problem found by Stéphane Chazelas
This commit is contained in:
parent
5cf460cc07
commit
dcdc828c41
14
check.t
14
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.671 2014/11/25 21:13:19 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.672 2014/12/15 22:50:08 tg Exp $
|
||||||
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
|
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@ -27,7 +27,7 @@
|
|||||||
# http://svnweb.freebsd.org/base/head/bin/test/tests/legacy_test.sh?view=co&content-type=text%2Fplain
|
# http://svnweb.freebsd.org/base/head/bin/test/tests/legacy_test.sh?view=co&content-type=text%2Fplain
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R50 2014/11/25
|
@(#)MIRBSD KSH R50 2014/12/15
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -36,7 +36,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R50 2014/11/25
|
@(#)LEGACY KSH R50 2014/12/15
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -2359,6 +2359,14 @@ stdin:
|
|||||||
expected-stdout:
|
expected-stdout:
|
||||||
baz
|
baz
|
||||||
---
|
---
|
||||||
|
name: heredoc-9f
|
||||||
|
description:
|
||||||
|
Check long here strings
|
||||||
|
stdin:
|
||||||
|
cat <<< "$( : )aa"
|
||||||
|
expected-stdout:
|
||||||
|
aa
|
||||||
|
---
|
||||||
name: heredoc-10
|
name: heredoc-10
|
||||||
description:
|
description:
|
||||||
Check direct here document assignment
|
Check direct here document assignment
|
||||||
|
25
lex.c
25
lex.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.194 2014/11/19 18:44:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.195 2014/12/15 22:50:10 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@ -1027,17 +1027,24 @@ yylex(int cf)
|
|||||||
/* copy word to unprefixed string ident */
|
/* copy word to unprefixed string ident */
|
||||||
sp = yylval.cp;
|
sp = yylval.cp;
|
||||||
dp = ident;
|
dp = ident;
|
||||||
if ((cf & HEREDELIM) && (sp[1] == '<'))
|
if ((cf & HEREDELIM) && (sp[1] == '<')) {
|
||||||
while ((dp - ident) < IDENT) {
|
herestringloop:
|
||||||
if ((c = *sp++) == CHAR)
|
switch ((c = *sp++)) {
|
||||||
*dp++ = *sp++;
|
case CHAR:
|
||||||
else if ((c != OQUOTE) && (c != CQUOTE))
|
++sp;
|
||||||
break;
|
/* FALLTHROUGH */
|
||||||
|
case OQUOTE:
|
||||||
|
case CQUOTE:
|
||||||
|
goto herestringloop;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
/* dummy value */
|
||||||
|
*dp++ = 'x';
|
||||||
|
} else
|
||||||
while ((dp - ident) < IDENT && (c = *sp++) == CHAR)
|
while ((dp - ident) < IDENT && (c = *sp++) == CHAR)
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp++;
|
||||||
/* Make sure the ident array stays '\0' padded */
|
/* make sure the ident array stays NUL padded */
|
||||||
memset(dp, 0, (ident + IDENT) - dp + 1);
|
memset(dp, 0, (ident + IDENT) - dp + 1);
|
||||||
if (c != EOS)
|
if (c != EOS)
|
||||||
/* word is not unquoted */
|
/* word is not unquoted */
|
||||||
|
4
sh.h
4
sh.h
@ -169,9 +169,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.705 2014/11/25 21:13:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.706 2014/12/15 22:50:11 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R50 2014/11/25"
|
#define MKSH_VERSION "R50 2014/12/15"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user