fix severe regression in field splitting (LP#1378208)
This commit is contained in:
6
Build.sh
6
Build.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.668 2014/10/03 17:32:07 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.669 2014/10/07 15:22:12 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014
|
# 2011, 2012, 2013, 2014
|
||||||
@@ -1784,7 +1784,7 @@ else
|
|||||||
#define EXTERN
|
#define EXTERN
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.668 2014/10/03 17:32:07 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.669 2014/10/07 15:22:12 tg Exp $");
|
||||||
int main(void) { printf("Hello, World!\n"); return (isatty(0)); }
|
int main(void) { printf("Hello, World!\n"); return (isatty(0)); }
|
||||||
EOF
|
EOF
|
||||||
case $cm in
|
case $cm in
|
||||||
@@ -2316,7 +2316,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c
|
|||||||
addsrcs USE_PRINTF_BUILTIN printf.c
|
addsrcs USE_PRINTF_BUILTIN printf.c
|
||||||
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
||||||
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
||||||
add_cppflags -DMKSH_BUILD_R=503
|
add_cppflags -DMKSH_BUILD_R=504
|
||||||
|
|
||||||
$e $bi$me: Finished configuration testing, now producing output.$ao
|
$e $bi$me: Finished configuration testing, now producing output.$ao
|
||||||
|
|
||||||
|
4
Makefile
4
Makefile
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.137 2014/10/03 17:32:08 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.138 2014/10/07 15:22:13 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014
|
# 2011, 2012, 2013, 2014
|
||||||
@@ -55,7 +55,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
|
|||||||
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
||||||
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
||||||
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
||||||
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=503
|
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=504
|
||||||
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
||||||
CPPFLAGS+= -I.
|
CPPFLAGS+= -I.
|
||||||
COPTS+= -std=c89 -Wall
|
COPTS+= -std=c89 -Wall
|
||||||
|
12
check.t
12
check.t
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.660 2014/10/04 11:47:16 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.661 2014/10/07 15:22:14 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://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R50 2014/10/04
|
@(#)MIRBSD KSH R50 2014/10/07
|
||||||
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/10/04
|
@(#)LEGACY KSH R50 2014/10/07
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -3736,12 +3736,18 @@ expected-stdout:
|
|||||||
name: IFS-subst-3
|
name: IFS-subst-3
|
||||||
description:
|
description:
|
||||||
Check leading IFS non-whitespace after trim does make a field
|
Check leading IFS non-whitespace after trim does make a field
|
||||||
|
but leading IFS whitespace does not, nor empty replacements
|
||||||
stdin:
|
stdin:
|
||||||
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
showargs() { for i; do echo -n " <$i>"; done; echo; }
|
||||||
|
showargs 0 ${-+}
|
||||||
IFS=:
|
IFS=:
|
||||||
showargs 1 ${-+:foo:bar}
|
showargs 1 ${-+:foo:bar}
|
||||||
|
IFS=' '
|
||||||
|
showargs 2 ${-+ foo bar}
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
|
<0>
|
||||||
<1> <> <foo> <bar>
|
<1> <> <foo> <bar>
|
||||||
|
<2> <foo> <bar>
|
||||||
---
|
---
|
||||||
name: IFS-subst-4-1
|
name: IFS-subst-4-1
|
||||||
description:
|
description:
|
||||||
|
13
eval.c
13
eval.c
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.152 2014/10/03 17:32:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.153 2014/10/07 15:22:16 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* string expansion
|
* string expansion
|
||||||
@@ -62,6 +62,7 @@ typedef struct {
|
|||||||
#define IFS_WORD 0 /* word has chars (or quotes) */
|
#define IFS_WORD 0 /* word has chars (or quotes) */
|
||||||
#define IFS_WS 1 /* have seen IFS white-space */
|
#define IFS_WS 1 /* have seen IFS white-space */
|
||||||
#define IFS_NWS 2 /* have seen IFS non-white-space */
|
#define IFS_NWS 2 /* have seen IFS non-white-space */
|
||||||
|
#define IFS_IWS 3 /* begin of word, ignore IFS WS */
|
||||||
|
|
||||||
static int varsub(Expand *, const char *, const char *, int *, int *);
|
static int varsub(Expand *, const char *, const char *, int *, int *);
|
||||||
static int comsub(Expand *, const char *, int);
|
static int comsub(Expand *, const char *, int);
|
||||||
@@ -663,7 +664,7 @@ expand(
|
|||||||
f |= DOTEMP;
|
f |= DOTEMP;
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
word = IFS_WORD;
|
word = quote ? IFS_WORD : IFS_IWS;
|
||||||
/* Enable tilde expansion */
|
/* Enable tilde expansion */
|
||||||
tilde_ok = 1;
|
tilde_ok = 1;
|
||||||
f |= DOTILDE;
|
f |= DOTILDE;
|
||||||
@@ -907,12 +908,12 @@ expand(
|
|||||||
* IFS_WORD w/WS w/NWS w
|
* IFS_WORD w/WS w/NWS w
|
||||||
* IFS_WS -/WS -/NWS -
|
* IFS_WS -/WS -/NWS -
|
||||||
* IFS_NWS -/NWS w/NWS -
|
* IFS_NWS -/NWS w/NWS -
|
||||||
|
* IFS_IWS -/WS w/NWS -
|
||||||
* (w means generate a word)
|
* (w means generate a word)
|
||||||
* Note that IFS_NWS/0 generates a word (AT&T ksh
|
|
||||||
* doesn't do this, but POSIX does).
|
|
||||||
*/
|
*/
|
||||||
if (word == IFS_WORD ||
|
if ((word == IFS_WORD) || (c &&
|
||||||
(word == IFS_NWS && c && !ctype(c, C_IFSWS))) {
|
(word == IFS_IWS || word == IFS_NWS) &&
|
||||||
|
!ctype(c, C_IFSWS))) {
|
||||||
emit_word:
|
emit_word:
|
||||||
*dp++ = '\0';
|
*dp++ = '\0';
|
||||||
cp = Xclose(ds, dp);
|
cp = Xclose(ds, dp);
|
||||||
|
6
sh.h
6
sh.h
@@ -169,9 +169,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.696 2014/10/04 11:47:18 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.697 2014/10/07 15:22:17 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R50 2014/10/04"
|
#define MKSH_VERSION "R50 2014/10/07"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@@ -533,7 +533,7 @@ char *ucstrstr(char *, const char *);
|
|||||||
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 503)
|
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 504)
|
||||||
#error Must run Build.sh to compile this.
|
#error Must run Build.sh to compile this.
|
||||||
extern void thiswillneverbedefinedIhope(void);
|
extern void thiswillneverbedefinedIhope(void);
|
||||||
int
|
int
|
||||||
|
Reference in New Issue
Block a user