draft a testcase to understand the problem fixed by cid 1004BBF77B81D30DA7C
and make it actually work: the OpenBSD fix failed since 1004BBDD84556472D84
This commit is contained in:
parent
3fa79f3ea4
commit
14ea7e9038
13
check.t
13
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.372 2010/04/09 14:46:43 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.373 2010/04/09 19:16:29 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $
|
# $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
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R39 2010/04/08
|
@(#)MIRBSD KSH R39 2010/04/09
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -5837,6 +5837,15 @@ expected-stdout:
|
|||||||
z w
|
z w
|
||||||
v u
|
v u
|
||||||
---
|
---
|
||||||
|
name: varexpand-null-2
|
||||||
|
description:
|
||||||
|
Ensure empty strings, when quoted, are expanded as empty strings
|
||||||
|
stdin:
|
||||||
|
printf '<%s> ' 1 "${a}" 2 "${a#?}" + "${b%?}" 3 "${a=}" + "${b/c/d}"
|
||||||
|
echo .
|
||||||
|
expected-stdout:
|
||||||
|
<1> <> <2> <> <+> <> <3> <> <+> <> .
|
||||||
|
---
|
||||||
name: print-funny-chars
|
name: print-funny-chars
|
||||||
description:
|
description:
|
||||||
Check print builtin's capability to output designated characters
|
Check print builtin's capability to output designated characters
|
||||||
|
15
eval.c
15
eval.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.85 2010/04/09 18:53:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.86 2010/04/09 19:16:30 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* string expansion
|
* string expansion
|
||||||
@ -188,7 +188,8 @@ typedef struct SubType {
|
|||||||
short stype; /* [=+-?%#] action after expanded word */
|
short stype; /* [=+-?%#] action after expanded word */
|
||||||
short base; /* begin position of expanded word */
|
short base; /* begin position of expanded word */
|
||||||
short f; /* saved value of f (DOPAT, etc) */
|
short f; /* saved value of f (DOPAT, etc) */
|
||||||
short quote; /* saved value of quote (for ${..[%#]..}) */
|
uint8_t quotep; /* saved value of quote (for ${..[%#]..}) */
|
||||||
|
uint8_t quotew; /* saved value of quote (for ${..[+-=]..}) */
|
||||||
} SubType;
|
} SubType;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -263,7 +264,7 @@ expand(const char *cp, /* input word */
|
|||||||
quote = 1;
|
quote = 1;
|
||||||
continue;
|
continue;
|
||||||
case CQUOTE:
|
case CQUOTE:
|
||||||
quote = st->quote; /* XXX correct? */
|
quote = st->quotew;
|
||||||
continue;
|
continue;
|
||||||
case COMSUB:
|
case COMSUB:
|
||||||
tilde_ok = 0;
|
tilde_ok = 0;
|
||||||
@ -352,7 +353,7 @@ expand(const char *cp, /* input word */
|
|||||||
st->base = Xsavepos(ds, dp);
|
st->base = Xsavepos(ds, dp);
|
||||||
st->f = f;
|
st->f = f;
|
||||||
st->var = x.var;
|
st->var = x.var;
|
||||||
st->quote = quote;
|
st->quotew = st->quotep = quote;
|
||||||
/* skip qualifier(s) */
|
/* skip qualifier(s) */
|
||||||
if (stype)
|
if (stype)
|
||||||
sp += slen;
|
sp += slen;
|
||||||
@ -517,7 +518,7 @@ expand(const char *cp, /* input word */
|
|||||||
/* ! DOBLANK,DOBRACE_,DOTILDE */
|
/* ! DOBLANK,DOBRACE_,DOTILDE */
|
||||||
f = DOPAT | (f&DONTRUNCOMMAND) |
|
f = DOPAT | (f&DONTRUNCOMMAND) |
|
||||||
DOTEMP_;
|
DOTEMP_;
|
||||||
st->quote = quote = 0;
|
st->quotew = quote = 0;
|
||||||
/* Prepend open pattern (so |
|
/* Prepend open pattern (so |
|
||||||
* in a trim will work as
|
* in a trim will work as
|
||||||
* expected)
|
* expected)
|
||||||
@ -567,7 +568,7 @@ expand(const char *cp, /* input word */
|
|||||||
sp++; /* ({) skip the } or x */
|
sp++; /* ({) skip the } or x */
|
||||||
tilde_ok = 0; /* in case of ${unset:-} */
|
tilde_ok = 0; /* in case of ${unset:-} */
|
||||||
*dp = '\0';
|
*dp = '\0';
|
||||||
quote = st->quote;
|
quote = st->quotew;
|
||||||
f = st->f;
|
f = st->f;
|
||||||
if (f&DOBLANK)
|
if (f&DOBLANK)
|
||||||
doblank--;
|
doblank--;
|
||||||
@ -583,7 +584,7 @@ expand(const char *cp, /* input word */
|
|||||||
*/
|
*/
|
||||||
x.str = trimsub(str_val(st->var),
|
x.str = trimsub(str_val(st->var),
|
||||||
dp, st->stype);
|
dp, st->stype);
|
||||||
if (x.str[0] != '\0' || st->quote)
|
if (x.str[0] != '\0' || st->quotep)
|
||||||
type = XSUB;
|
type = XSUB;
|
||||||
else
|
else
|
||||||
type = XNULLSUB;
|
type = XNULLSUB;
|
||||||
|
4
sh.h
4
sh.h
@ -150,9 +150,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.387 2010/04/08 13:21:08 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.388 2010/04/09 19:16:31 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2010/04/08"
|
#define MKSH_VERSION "R39 2010/04/09"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user