From 5018e4a21b7f05a0c3c06948a38a225fe6a61615 Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 13 Oct 2015 21:39:53 +0000 Subject: [PATCH 1/3] another testcase, before I go changing the way let] is handled --- check.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check.t b/check.t index 3d55bbb..d8475ad 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.710 2015/10/09 21:36:52 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.711 2015/10/13 21:39:53 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -475,6 +475,9 @@ stdin: va[1975973142]=right va[4123456789]=wrong echo x7 ${va[#4123456789%2147483647]} + # make sure multiple calculations don't interfere with each other + let '# mca = -4 % -2' ' mcb = -4 % -2' + echo x8 $mca $mcb expected-stdout: x1 -1 4294967295 x2 -171510507 4123456789 @@ -483,6 +486,7 @@ expected-stdout: x5 -171510507 4123456789 x6 1975973142 1975973142 x7 right + x8 -4 0 --- name: arith-limit32-1 description: From 1a4f644d6e9407e6c50708d678595edf29a8128a Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 24 Oct 2015 19:45:23 +0000 Subject: [PATCH 2/3] =?UTF-8?q?save=20~1=C2=BDK=20from=20the=20bootfloppy?= =?UTF-8?q?=20by=20reusing=20MirBSD=20libkern=20wcwidth(3)=20but=20don?= =?UTF-8?q?=E2=80=99t=20bother=20for=20this=20for=20the=20regular=20/bin/m?= =?UTF-8?q?ksh=20either=20to=20keep=20the=20generic=20code=20path=20tested?= =?UTF-8?q?=20well?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- expr.c | 4 +++- sh.h | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/expr.c b/expr.c index a883906..8a4bb31 100644 --- a/expr.c +++ b/expr.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.78 2015/09/05 19:19:03 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.79 2015/10/24 19:45:23 tg Exp $"); /* the order of these enums is constrained by the order of opinfo[] */ enum token { @@ -916,6 +916,7 @@ ksh_access(const char *fn, int mode) return (rv); } +#ifndef MIRBSD_BOOTFLOPPY /* From: X11/xc/programs/xterm/wcwidth.c,v 1.8 2014/06/24 19:53:53 tg Exp $ */ struct mb_ucsrange { @@ -1195,3 +1196,4 @@ utf_wcwidth(unsigned int wc) return (2); return (1); } +#endif diff --git a/sh.h b/sh.h index 1aaffc7..fb69e28 100644 --- a/sh.h +++ b/sh.h @@ -108,6 +108,9 @@ #if HAVE_VALUES_H #include #endif +#ifdef MIRBSD_BOOTFLOPPY +#include +#endif #undef __attribute__ #if HAVE_ATTRIBUTE_BOUNDED @@ -172,9 +175,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.749 2015/10/09 21:36:59 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.750 2015/10/24 19:45:23 tg Exp $"); #endif -#define MKSH_VERSION "R51 2015/10/09" +#define MKSH_VERSION "R51 2015/10/24" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES @@ -1727,7 +1730,11 @@ int utf_widthadj(const char *, const char **); size_t utf_mbswidth(const char *) MKSH_A_PURE; const char *utf_skipcols(const char *, int) MKSH_A_PURE; size_t utf_ptradj(const char *) MKSH_A_PURE; +#ifdef MIRBSD_BOOTFLOPPY +#define utf_wcwidth(i) wcwidth((wchar_t)(i)) +#else int utf_wcwidth(unsigned int) MKSH_A_PURE; +#endif int ksh_access(const char *, int); struct tbl *tempvar(void); /* funcs.c */ From 7a47656efe60429cb40ca026309e4ce4f0322037 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 24 Oct 2015 19:46:10 +0000 Subject: [PATCH 3/3] =?UTF-8?q?fix=20\u0000=20and=20\x00=20being=20ignored?= =?UTF-8?q?=20in=20$'=E2=80=A6'=20and=20print=20+r=20expansion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.t | 29 ++++++++++++++++++++++++++--- funcs.c | 6 ++++-- lex.c | 7 ++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/check.t b/check.t index d8475ad..a87959e 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.711 2015/10/13 21:39:53 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.712 2015/10/24 19:46:07 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R51 2015/10/09 + @(#)MIRBSD KSH R51 2015/10/24 description: Check version of shell. stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R51 2015/10/09 + @(#)LEGACY KSH R51 2015/10/24 description: Check version of legacy shell. stdin: @@ -8538,13 +8538,36 @@ expected-stdout: 0 1 --- +name: varexpand-funny-chars +description: + Check some characters + XXX \uEF80 is asymmetric, possibly buggy so we don’t check this +stdin: + x=$'<\x00>'; typeset -p x + x=$'<\x01>'; typeset -p x + x=$'<\u0000>'; typeset -p x + x=$'<\u0001>'; typeset -p x +expected-stdout: + typeset x='<' + typeset x=$'<\001>' + typeset x='<' + typeset x=$'<\001>' +--- name: print-funny-chars description: Check print builtin's capability to output designated characters stdin: print '<\0144\0344\xDB\u00DB\u20AC\uDB\x40>' + print '<\x00>' + print '<\x01>' + print '<\u0000>' + print '<\u0001>' expected-stdout: + <> + <> + <> + <> --- name: print-bksl-c description: diff --git a/funcs.c b/funcs.c index 614eadc..16fcb0f 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.286 2015/10/09 21:36:55 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.287 2015/10/24 19:46:09 tg Exp $"); #if HAVE_KILLPG /* @@ -431,8 +431,10 @@ c_print(const char **wp) char ts[4]; ts[utf_wctomb(ts, c - 0x100)] = 0; - for (c = 0; ts[c]; ++c) + c = 0; + do { Xput(xs, xp, ts[c]); + } while (ts[++c]); continue; } } diff --git a/lex.c b/lex.c index b0cfc26..740265a 100644 --- a/lex.c +++ b/lex.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.212 2015/10/09 19:29:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.213 2015/10/24 19:46:10 tg Exp $"); /* * states while lexing word @@ -601,10 +601,11 @@ yylex(int cf) } else { cz = utf_wctomb(ts, c2 - 0x100); ts[cz] = 0; - for (cz = 0; ts[cz]; ++cz) { + cz = 0; + do { *wp++ = QCHAR; *wp++ = ts[cz]; - } + } while (ts[++cz]); } } } else if (!statep->ls_bool) {