followup fix for 1004D90467358D6B13C regarding escaped substitutions
found in, out of all things, Debian/m68k, by Wouter Verhelst (Yoe) fix hacked at DebConf 11, Бања Лука, Република Српска, Босна и Херцеговина
This commit is contained in:
parent
a7566387cf
commit
80223417d7
13
check.t
13
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.478 2011/07/20 23:47:26 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.479 2011/07/26 16:57:25 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -25,7 +25,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R40 2011/07/20
|
||||
@(#)MIRBSD KSH R40 2011/07/26
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
@ -1603,16 +1603,17 @@ stdin:
|
||||
set +o sh
|
||||
x=foobar
|
||||
y=foobaz
|
||||
echo "<${x%bar|baz},${y%bar|baz}>"
|
||||
z=fooba\?
|
||||
echo "<${x%bar|baz},${y%bar|baz},${z%\?}>"
|
||||
echo "<${x%ba(r|z)},${y%ba(r|z)}>"
|
||||
set -o sh
|
||||
echo "<${x%bar|baz},${y%bar|baz}>"
|
||||
echo "<${x%bar|baz},${y%bar|baz},${z%\?}>"
|
||||
z='foo(bar'
|
||||
echo "<${z%(*}>"
|
||||
expected-stdout:
|
||||
<foo,foo,fooba>
|
||||
<foo,foo>
|
||||
<foo,foo>
|
||||
<foobar,foobaz>
|
||||
<foobar,foobaz,fooba>
|
||||
<foo>
|
||||
---
|
||||
name: eglob-substrpl-1
|
||||
|
34
lex.c
34
lex.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.153 2011/06/04 16:11:18 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.154 2011/07/26 16:57:27 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -40,9 +40,10 @@ __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.153 2011/06/04 16:11:18 tg Exp $");
|
||||
#define SHEREDELIM 10 /* parsing <<,<<- delimiter */
|
||||
#define SHEREDQUOTE 11 /* parsing " in <<,<<- delimiter */
|
||||
#define SPATTERN 12 /* parsing *(...|...) pattern (*+?@!) */
|
||||
#define STBRACE 13 /* parsing ${...[#%]...} */
|
||||
#define SADELIM 14 /* like SBASE, looking for delimiter */
|
||||
#define SHERESTRING 15 /* parsing <<< string */
|
||||
#define SADELIM 13 /* like SBASE, looking for delimiter */
|
||||
#define SHERESTRING 14 /* parsing <<< string */
|
||||
#define STBRACEKORN 15 /* parsing ${...[#%]...} !FSH */
|
||||
#define STBRACEBOURNE 16 /* parsing ${...[#%]...} FSH */
|
||||
#define SINVALID 255 /* invalid state */
|
||||
|
||||
struct sretrace_info {
|
||||
@ -456,9 +457,12 @@ yylex(int cf)
|
||||
* If this is a trim operation,
|
||||
* treat (,|,) specially in STBRACE.
|
||||
*/
|
||||
if (!Flag(FSH) && ctype(c, C_SUBOP2)) {
|
||||
if (ctype(c, C_SUBOP2)) {
|
||||
ungetsc(c);
|
||||
PUSH_STATE(STBRACE);
|
||||
if (Flag(FSH))
|
||||
PUSH_STATE(STBRACEBOURNE);
|
||||
else
|
||||
PUSH_STATE(STBRACEKORN);
|
||||
} else {
|
||||
ungetsc(c);
|
||||
if (state == SDQUOTE)
|
||||
@ -687,19 +691,21 @@ yylex(int cf)
|
||||
*wp++ = /*{*/ '}';
|
||||
break;
|
||||
|
||||
case STBRACE:
|
||||
/* Same as SBASE, except (,|,) treated specially */
|
||||
if (c == /*{*/ '}') {
|
||||
POP_STATE();
|
||||
*wp++ = CSUBST;
|
||||
*wp++ = /*{*/ '}';
|
||||
} else if (c == '|') {
|
||||
/* Same as SBASE, except (,|,) treated specially */
|
||||
case STBRACEKORN:
|
||||
if (c == '|')
|
||||
*wp++ = SPAT;
|
||||
} else if (c == '(') {
|
||||
else if (c == '(') {
|
||||
*wp++ = OPAT;
|
||||
/* simile for @ */
|
||||
*wp++ = ' ';
|
||||
PUSH_STATE(SPATTERN);
|
||||
} else /* FALLTHROUGH */
|
||||
case STBRACEBOURNE:
|
||||
if (c == /*{*/ '}') {
|
||||
POP_STATE();
|
||||
*wp++ = CSUBST;
|
||||
*wp++ = /*{*/ '}';
|
||||
} else
|
||||
goto Sbase1;
|
||||
break;
|
||||
|
4
sh.h
4
sh.h
@ -151,9 +151,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.489 2011/07/20 23:47:29 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.490 2011/07/26 16:57:28 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2011/07/20"
|
||||
#define MKSH_VERSION "R40 2011/07/26"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user