fix allexport for arrays; add testcase that also catches exporting arrays
This commit is contained in:
21
check.t
21
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.802 2018/03/09 01:29:08 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.803 2018/04/28 07:07:35 tg Exp $
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@ -30,7 +30,7 @@
|
|||||||
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R56 2018/03/09
|
@(#)MIRBSD KSH R56 2018/04/28
|
||||||
description:
|
description:
|
||||||
Check base version of full shell
|
Check base version of full shell
|
||||||
stdin:
|
stdin:
|
||||||
@ -39,7 +39,7 @@ name: KSH_VERSION
|
|||||||
category: !shell:legacy-yes
|
category: !shell:legacy-yes
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R56 2018/03/09
|
@(#)LEGACY KSH R56 2018/04/28
|
||||||
description:
|
description:
|
||||||
Check base version of legacy shell
|
Check base version of legacy shell
|
||||||
stdin:
|
stdin:
|
||||||
@ -6854,6 +6854,21 @@ expected-stdout:
|
|||||||
3 10 .
|
3 10 .
|
||||||
4 -2147483646 .
|
4 -2147483646 .
|
||||||
---
|
---
|
||||||
|
name: export-1
|
||||||
|
description:
|
||||||
|
Check allexport works, basic
|
||||||
|
stdin:
|
||||||
|
qa=1
|
||||||
|
set -A qb 2 3
|
||||||
|
set -a
|
||||||
|
qc=4
|
||||||
|
set -A qd 5 6
|
||||||
|
export -p | grep '^export q'
|
||||||
|
expected-stdout:
|
||||||
|
export qc=4
|
||||||
|
export qd[0]=5
|
||||||
|
export qd[1]=6
|
||||||
|
---
|
||||||
name: readonly-0
|
name: readonly-0
|
||||||
description:
|
description:
|
||||||
Ensure readonly is honoured for assignments and unset
|
Ensure readonly is honoured for assignments and unset
|
||||||
|
4
sh.h
4
sh.h
@ -182,9 +182,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.859 2018/03/09 01:29:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.860 2018/04/28 07:07:37 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R56 2018/03/09"
|
#define MKSH_VERSION "R56 2018/04/28"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
5
var.c
5
var.c
@ -28,7 +28,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.223 2018/01/13 23:55:15 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.224 2018/04/28 07:07:39 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -1617,6 +1617,9 @@ set_array(const char *var, bool reset, const char **vals)
|
|||||||
unset(vp, 1);
|
unset(vp, 1);
|
||||||
/* allocate-by-access the [0] element to keep in scope */
|
/* allocate-by-access the [0] element to keep in scope */
|
||||||
arraysearch(vp, 0);
|
arraysearch(vp, 0);
|
||||||
|
/* honour set -o allexport */
|
||||||
|
if (Flag(FEXPORT))
|
||||||
|
typeset(ccp, EXPORT, 0, 0, 0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* TODO: would be nice for assignment to completely succeed or
|
* TODO: would be nice for assignment to completely succeed or
|
||||||
|
Reference in New Issue
Block a user