mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
This fixes the following regressions marked TODO in attributes.sh: $ typeset -L 13 bar; readonly bar; typeset -p bar typeset -r -L 0 foo # exp.: typeset -r -L 13 foo $ typeset -R 13 bar; readonly bar; typeset -p bar typeset -r -R 0 bar # exp.: typeset -r -R 13 bar $ typeset -Z 13 baz; readonly baz; typeset -p baz typeset -r -Z 0 -R 0 baz # exp.: typeset -r Z 13 -R 13 baz I've discovered that these were briefly fixed betweenfdb9781e
(Red Hat patch for typeset -xu/-xl) and95fe07d8
(reversal of patch, different -xu/-xl fix, but reintroduced these regressions). src/cmd/ksh93/sh/name.c: nv_newattr(): - Replace check from95fe07d8
with a new one that combines its approach with that offdb9781e
: do not change size (and hence return early) if NV_RDONLY and/or NV_EXPORT are the only attributes that are changing. src/cmd/ksh93/tests/attributes.sh: - Enable the TODO regression tests.
This commit is contained in:
parent
fe05350f2d
commit
0e4c4d619d
2 changed files with 5 additions and 6 deletions
|
@ -2966,11 +2966,10 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size)
|
|||
nv_onattr(np,NV_EXPORT);
|
||||
sh_envput(shp->env,np);
|
||||
}
|
||||
if((n^newatts)==NV_EXPORT && !trans)
|
||||
/* Only EXPORT attribute has changed and thus all work has been done. */
|
||||
return;
|
||||
}
|
||||
oldsize = nv_size(np);
|
||||
if(((n^newatts) & ~(NV_EXPORT|NV_RDONLY))==0)
|
||||
size = oldsize;
|
||||
if((size==oldsize|| (n&NV_INTEGER)) && !trans && ((n^newatts)&~NV_NOCHANGE)==0)
|
||||
{
|
||||
if(size>0)
|
||||
|
|
|
@ -526,16 +526,16 @@ typeset -A expect=(
|
|||
[F12]='typeset -x -r -F 12 foo'
|
||||
[H]='typeset -x -r -H foo'
|
||||
[L]='typeset -x -r -L 0 foo'
|
||||
# [L17]='typeset -x -r -L 17 foo' # TODO: outputs '-L 0'
|
||||
[L17]='typeset -x -r -L 17 foo'
|
||||
[Mtolower]='typeset -x -r -l foo'
|
||||
[Mtoupper]='typeset -x -r -u foo'
|
||||
[R]='typeset -x -r -R 0 foo'
|
||||
# [R17]='typeset -x -r -R 17 foo' # TODO: outputs '-L 0'
|
||||
[R17]='typeset -x -r -R 17 foo'
|
||||
[X17]='typeset -x -r -X 17 foo'
|
||||
[S]='typeset -x -r foo'
|
||||
[T]='typeset -x -r foo'
|
||||
[Z]='typeset -x -r -Z 0 -R 0 foo'
|
||||
# [Z13]='typeset -x -r -Z 13 -R 13 foo' # TODO: outputs 'typeset -x -r -Z 0 -R 0 foo'
|
||||
[Z13]='typeset -x -r -Z 13 -R 13 foo'
|
||||
)
|
||||
for flag in "${!expect[@]}"
|
||||
do unset foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue