mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
Fix disabling SHOPT_FIXEDARRAY (re: 2182ecfa
)
It was easier than expected to fix this one. The many regression test failures caused by disabling it were all due to one bug: 'typeset -p' output broke when building without this option. src/cmd/ksh93/sh/nvtree.c: nv_attribute(): - In this function to print the attributes of a name-value pair, move four lines of code out of #if SHOPT_FIXEDARRAY...#endif that were inadvertently moved into the #if block in ksh93 2012-05-18. See the changes to nvtree.c in this multishell repo commit: https://github.com/multishell/ksh93/commit/aabab56a src/cmd/ksh93/data/builtins.c: - Update/rewrite 'typeset -a' documentation. - Make it adapt to SHOPT_FIXEDARRAY. - Fix a few typos. src/cmd/ksh93/tests/arrays2.sh: - Only one regression test needs a SHOPT_FIXEDARRAY check. .github/workflows/ci.yml: - Disable SHOPT_FIXEDARRAY when regression-testing without SHOPTs. - Enable xtrace, add ':' commands for traced comments. This should make the CI runner output logs a little more readable.
This commit is contained in:
parent
2182ecfa08
commit
76ea18dcbd
5 changed files with 29 additions and 11 deletions
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
@ -14,13 +14,19 @@ jobs:
|
|||
run: bin/package make
|
||||
- name: Regression tests
|
||||
run: |
|
||||
PS4="$PS4 [ci.yml] "
|
||||
set -o xtrace
|
||||
export TZ=UTC
|
||||
ulimit -n 1024
|
||||
: default regression tests &&
|
||||
script -q -e -c "bin/shtests" &&
|
||||
: regression tests with OS-provided UTF-8 locales &&
|
||||
LANG=nl_NL.UTF-8 script -q -e -c "bin/shtests --locale --nocompile" &&
|
||||
LANG=ja_JP.UTF-8 script -q -e -c "bin/shtests --locale --nocompile" &&
|
||||
: disable most SHOPTs, rebuild ksh &&
|
||||
sed --regexp-extended --in-place=.orig \
|
||||
'/^SHOPT (2DMATCH|AUDIT|BGX|BRACEPAT|DYNAMIC|EDPREDICT|ESH|HISTEXPAND|MULTIBYTE|NAMESPACE|OPTIMIZE|SUID_EXEC|STATS|VSH)=/ s/=1/=0/' \
|
||||
'/^SHOPT (2DMATCH|AUDIT|BGX|BRACEPAT|DYNAMIC|EDPREDICT|ESH|FIXEDARRAY|HISTEXPAND|MULTIBYTE|NAMESPACE|OPTIMIZE|SUID_EXEC|STATS|VSH)=/ s/=1/=0/' \
|
||||
src/cmd/ksh93/SHOPT.sh &&
|
||||
bin/package make &&
|
||||
: default regression tests with SHOPTs disabled &&
|
||||
script -q -e -c "bin/shtests"
|
||||
|
|
|
@ -1743,7 +1743,7 @@ const char sh_opttrap[] =
|
|||
;
|
||||
|
||||
const char sh_opttypeset[] =
|
||||
"+[-1c?\n@(#)$Id: typeset (ksh 93u+m) 2021-01-20 $\n]"
|
||||
"+[-1c?\n@(#)$Id: typeset (ksh 93u+m) 2021-02-10 $\n]"
|
||||
"[--catalog?" SH_DICT "]"
|
||||
"[+NAME?typeset - declare or display variables with attributes]"
|
||||
"[+DESCRIPTION?Without the \b-f\b option, \btypeset\b sets, unsets, "
|
||||
|
@ -1782,11 +1782,23 @@ const char sh_opttypeset[] =
|
|||
"[+?\btypeset\b is built in to the shell as a declaration command so that "
|
||||
"field splitting and pathname expansion are not performed on "
|
||||
"the arguments. Tilde expansion occurs on \avalue\a.]"
|
||||
"[a]:?[type?Indexed array. This is the default. If \b[\b\atype\a\b]]\b is "
|
||||
"specified, each subscript is interpreted as a value of type \atype\a.]"
|
||||
"[b?Each \aname\a may contain binary data. Its value is the mime "
|
||||
"base64 encoding of the data. It can be used with \b-Z\b, "
|
||||
"to specify fixed sized fields.]"
|
||||
"[a]:?[[type]]?Indexed array. This is the default. Subscripts start at 0. "
|
||||
#if SHOPT_FIXEDARRAY
|
||||
"Each simple \aname\a creates a dynamic-size array with arbitrary "
|
||||
"dimensions. A \aname\a in the format \aname\a\b[\b\an\a\b]]\b creates "
|
||||
"a fixed-size array and any attempt to access a subscript \an\a or "
|
||||
"higher is an error. Multidimensional fixed-size arrays "
|
||||
"\aname\a\b[\b\an1\a\b]][\b\an2\a\b]]\b... are also supported. "
|
||||
#else
|
||||
"Each \aname\a creates a dynamic-size array with arbitrary dimensions. "
|
||||
#endif
|
||||
"An option value in the format \b[\b\atype\a\b]]\b (including the "
|
||||
"square brackets), where \atype\a must be the name of an enumeration "
|
||||
"type created with \benum\b(1), allows enumeration constants to be "
|
||||
"used as subscripts.]"
|
||||
"[b?Each \aname\a may contain binary data. Its value is the MIME base64 "
|
||||
"encoding of the data. This option can be used with \b-Z\b to "
|
||||
"specify fixed-size fields.]"
|
||||
"[f?Each of the options and \aname\as refers to a function.]"
|
||||
"[i]#?[base:=10?An integer. \abase\a represents the arithmetic base "
|
||||
"from 2 to 64.]"
|
||||
|
@ -1810,7 +1822,7 @@ const char sh_opttypeset[] =
|
|||
"value will be displayed as an unsigned integer.]"
|
||||
"[x?Puts each \aname\a on the export list. See \bexport\b(1). \aname\a "
|
||||
"cannot contain a \b.\b.]"
|
||||
"[A?Associative array. Each \aname\a will converted to an associate "
|
||||
"[A?Associative array. Each \aname\a will converted to an associative "
|
||||
"array. If a variable already exists, the current value will "
|
||||
"become index \b0\b.]"
|
||||
"[C?Compound variable. Each \aname\a will be a compound variable. If "
|
||||
|
|
|
@ -1460,7 +1460,7 @@ an associative array with the given arguments as subscripts.
|
|||
For example,
|
||||
.ce
|
||||
\f5bar=( [color]=red [shape]=box )\fP
|
||||
creates an associate array named \f5bar\fP whose
|
||||
creates an associative array named \f5bar\fP whose
|
||||
subscripts are \f5color\fP and \f5shape\fP.
|
||||
.P
|
||||
The third form for \fIassignment-list\fP is a list of
|
||||
|
|
|
@ -524,11 +524,11 @@ void nv_attribute(register Namval_t *np,Sfio_t *out,char *prefix,int noname)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#if SHOPT_FIXEDARRAY
|
||||
if(fp)
|
||||
outtype(np,fp,out,prefix);
|
||||
if(noname)
|
||||
return;
|
||||
#if SHOPT_FIXEDARRAY
|
||||
if(fixed)
|
||||
{
|
||||
sfprintf(out,"%s",nv_name(np));
|
||||
|
|
|
@ -222,7 +222,7 @@ compound cx
|
|||
typeset -a cx.ar[4][4]
|
||||
print -v cx > /dev/null
|
||||
print -v cx | read -C l 2> /dev/null || err_exit 'read -C fails from output of print -v'
|
||||
[[ ${cx%cx=} == "${l%l=}" ]] || err_exit 'print -v for compound variable with fixed 2d array not working'
|
||||
((SHOPT_FIXEDARRAY)) && [[ ${cx%cx=} != "${l%l=}" ]] && err_exit 'print -v for compound variable with fixed 2d array not working'
|
||||
|
||||
# ======
|
||||
# Multidimensional arrays with an unset method shouldn't cause a crash.
|
||||
|
|
Loading…
Reference in a new issue