make readonly idempotent; spotted by selk from Dragora
This commit is contained in:
parent
ac262e5395
commit
b903a5e66a
13
check.t
13
check.t
|
@ -1,4 +1,4 @@
|
||||||
# $MirOS: src/bin/mksh/check.t,v 1.793 2017/05/14 19:05:44 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.794 2017/07/26 23:02:23 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 R55 2017/05/05
|
@(#)MIRBSD KSH R55 2017/07/26
|
||||||
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 R55 2017/05/01
|
@(#)LEGACY KSH R55 2017/07/26
|
||||||
description:
|
description:
|
||||||
Check base version of legacy shell
|
Check base version of legacy shell
|
||||||
stdin:
|
stdin:
|
||||||
|
@ -6906,6 +6906,13 @@ expected-exit: e != 0
|
||||||
expected-stderr-pattern:
|
expected-stderr-pattern:
|
||||||
/read[ -]?only/
|
/read[ -]?only/
|
||||||
---
|
---
|
||||||
|
name: readonly-5
|
||||||
|
description:
|
||||||
|
Ensure readonly is idempotent
|
||||||
|
stdin:
|
||||||
|
readonly x=1
|
||||||
|
readonly x
|
||||||
|
---
|
||||||
name: syntax-1
|
name: syntax-1
|
||||||
description:
|
description:
|
||||||
Check that lone ampersand is a syntax error
|
Check that lone ampersand is a syntax error
|
||||||
|
|
4
sh.h
4
sh.h
|
@ -175,9 +175,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.836 2017/05/05 22:53:30 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.837 2017/07/26 23:02:27 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R55 2017/05/05"
|
#define MKSH_VERSION "R55 2017/07/26"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
|
10
var.c
10
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.219 2017/05/05 22:53:32 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.220 2017/07/26 23:02:28 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
|
@ -917,12 +917,12 @@ typeset(const char *var, uint32_t set, uint32_t clr, int field, int base)
|
||||||
vpbase = (vp->flag & ARRAY) ? global(arrayname(tvar)) : vp;
|
vpbase = (vp->flag & ARRAY) ? global(arrayname(tvar)) : vp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* only allow export flag to be set; AT&T ksh allows any
|
* only allow export and readonly flag to be set; AT&T ksh
|
||||||
* attribute to be changed which means it can be truncated or
|
* allows any attribute to be changed which means it can be
|
||||||
* modified (-L/-R/-Z/-i)
|
* truncated or modified (-L/-R/-Z/-i)
|
||||||
*/
|
*/
|
||||||
if ((vpbase->flag & RDONLY) &&
|
if ((vpbase->flag & RDONLY) &&
|
||||||
(val || clr || (set & ~EXPORT)))
|
(val || clr || (set & ~(EXPORT | RDONLY))))
|
||||||
/* XXX check calls - is error here ok by POSIX? */
|
/* XXX check calls - is error here ok by POSIX? */
|
||||||
errorfx(2, Tf_ro, tvar);
|
errorfx(2, Tf_ro, tvar);
|
||||||
afree(tvar, ATEMP);
|
afree(tvar, ATEMP);
|
||||||
|
|
Loading…
Reference in New Issue