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 -*-
|
||||
#-
|
||||
# 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
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R55 2017/05/05
|
||||
@(#)MIRBSD KSH R55 2017/07/26
|
||||
description:
|
||||
Check base version of full shell
|
||||
stdin:
|
||||
@ -39,7 +39,7 @@ name: KSH_VERSION
|
||||
category: !shell:legacy-yes
|
||||
---
|
||||
expected-stdout:
|
||||
@(#)LEGACY KSH R55 2017/05/01
|
||||
@(#)LEGACY KSH R55 2017/07/26
|
||||
description:
|
||||
Check base version of legacy shell
|
||||
stdin:
|
||||
@ -6906,6 +6906,13 @@ expected-exit: e != 0
|
||||
expected-stderr-pattern:
|
||||
/read[ -]?only/
|
||||
---
|
||||
name: readonly-5
|
||||
description:
|
||||
Ensure readonly is idempotent
|
||||
stdin:
|
||||
readonly x=1
|
||||
readonly x
|
||||
---
|
||||
name: syntax-1
|
||||
description:
|
||||
Check that lone ampersand is a syntax error
|
||||
|
4
sh.h
4
sh.h
@ -175,9 +175,9 @@
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define MKSH_VERSION "R55 2017/05/05"
|
||||
#define MKSH_VERSION "R55 2017/07/26"
|
||||
|
||||
/* arithmetic types: C implementation */
|
||||
#if !HAVE_CAN_INTTYPES
|
||||
|
10
var.c
10
var.c
@ -28,7 +28,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#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
|
||||
@ -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;
|
||||
|
||||
/*
|
||||
* only allow export flag to be set; AT&T ksh allows any
|
||||
* attribute to be changed which means it can be truncated or
|
||||
* modified (-L/-R/-Z/-i)
|
||||
* only allow export and readonly flag to be set; AT&T ksh
|
||||
* allows any attribute to be changed which means it can be
|
||||
* truncated or modified (-L/-R/-Z/-i)
|
||||
*/
|
||||
if ((vpbase->flag & RDONLY) &&
|
||||
(val || clr || (set & ~EXPORT)))
|
||||
(val || clr || (set & ~(EXPORT | RDONLY))))
|
||||
/* XXX check calls - is error here ok by POSIX? */
|
||||
errorfx(2, Tf_ro, tvar);
|
||||
afree(tvar, ATEMP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user