Force local zsh emulation options

so the code is not broken by unexpected option changes, like

    setopt RC_EXPAND_PARAM

which breaks

    print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'

in the _zimfw_build_init function, for example.

See #444.
This commit is contained in:
Eric Nielsen 2021-11-21 14:29:33 -05:00
parent de685e8ef3
commit a5fb148ccf
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
7 changed files with 15 additions and 9 deletions

View File

@ -50,7 +50,6 @@ Initialization options:
_zfailed=1 _zfailed=1
return 2 return 2
fi fi
setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB
local zurl=${1} zmodule=${1:t} ztool zdir ztype zrev zarg local zurl=${1} zmodule=${1:t} ztool zdir ztype zrev zarg
local -i zdisabled=0 zfrozen=0 local -i zdisabled=0 zfrozen=0
local -a zfpaths zfunctions zcmds local -a zfpaths zfunctions zcmds

View File

@ -1,6 +1,5 @@
_zimfw_version_check() { _zimfw_version_check() {
if (( _zprintlevel > 0 )); then if (( _zprintlevel > 0 )); then
setopt LOCAL_OPTIONS EXTENDED_GLOB
local -r ztarget=${ZIM_HOME}/.latest_version local -r ztarget=${ZIM_HOME}/.latest_version
# If .latest_version does not exist or was not modified in the last 30 days # If .latest_version does not exist or was not modified in the last 30 days
if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then

View File

@ -1,4 +1,6 @@
zimfw() { zimfw() {
builtin emulate -L zsh
setopt EXTENDED_GLOB
local -r _zversion='<%= version %>' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='<%= version %>' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions:

View File

@ -1,5 +1,6 @@
() { () {
setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB builtin emulate -L zsh
setopt EXTENDED_GLOB
autoload -Uz zrecompile autoload -Uz zrecompile
local zdumpfile zfile local zdumpfile zfile

View File

@ -1,4 +1,6 @@
# This runs in a new shell # This runs in a new shell
builtin emulate -L zsh
setopt EXTENDED_GLOB
readonly -i PRINTLEVEL=${1} readonly -i PRINTLEVEL=${1}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} TEMP=.zdegit_${RANDOM} readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} TEMP=.zdegit_${RANDOM}
readonly TARBALL_TARGET=${DIR}/${TEMP}_tarball.tar.gz INFO_TARGET=${DIR}/.zdegit readonly TARBALL_TARGET=${DIR}/${TEMP}_tarball.tar.gz INFO_TARGET=${DIR}/.zdegit
@ -19,7 +21,6 @@ print_okay() {
} }
download_tarball() { download_tarball() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local host repo local host repo
if [[ ${URL} =~ <%= url_regex %> ]]; then if [[ ${URL} =~ <%= url_regex %> ]]; then
host=${match[3]} host=${match[3]}

View File

@ -1,4 +1,5 @@
# This runs in a new shell # This runs in a new shell
builtin emulate -L zsh
readonly -i PRINTLEVEL=${1} readonly -i PRINTLEVEL=${1}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} TYPE=${6:=branch} SUBMODULES=1 readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} TYPE=${6:=branch} SUBMODULES=1
REV=${7} REV=${7}

View File

@ -78,7 +78,8 @@ _zimfw_build_login_init() {
fi fi
_zimfw_mv =( _zimfw_mv =(
print -nR "() { print -nR "() {
setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB builtin emulate -L zsh
setopt EXTENDED_GLOB
autoload -Uz zrecompile autoload -Uz zrecompile
local zdumpfile zfile local zdumpfile zfile
@ -160,7 +161,6 @@ Initialization options:
_zfailed=1 _zfailed=1
return 2 return 2
fi fi
setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB
local zurl=${1} zmodule=${1:t} ztool zdir ztype zrev zarg local zurl=${1} zmodule=${1:t} ztool zdir ztype zrev zarg
local -i zdisabled=0 zfrozen=0 local -i zdisabled=0 zfrozen=0
local -a zfpaths zfunctions zcmds local -a zfpaths zfunctions zcmds
@ -330,7 +330,6 @@ _zimfw_list_unuseds() {
_zimfw_version_check() { _zimfw_version_check() {
if (( _zprintlevel > 0 )); then if (( _zprintlevel > 0 )); then
setopt LOCAL_OPTIONS EXTENDED_GLOB
local -r ztarget=${ZIM_HOME}/.latest_version local -r ztarget=${ZIM_HOME}/.latest_version
# If .latest_version does not exist or was not modified in the last 30 days # If .latest_version does not exist or was not modified in the last 30 days
if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then
@ -373,7 +372,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-11-15 16:43:17 UTC, previous commit is e060934)' print -R 'zimfw version: '${_zversion}' (built at 2021-11-21 19:26:56 UTC, previous commit is de685e8)'
print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)
@ -483,6 +482,8 @@ _zimfw_run_tool() {
local zcmd local zcmd
case ${ztool} in case ${ztool} in
degit) zcmd="# This runs in a new shell degit) zcmd="# This runs in a new shell
builtin emulate -L zsh
setopt EXTENDED_GLOB
readonly -i PRINTLEVEL=\${1} readonly -i PRINTLEVEL=\${1}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} TEMP=.zdegit_\${RANDOM} readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} TEMP=.zdegit_\${RANDOM}
readonly TARBALL_TARGET=\${DIR}/\${TEMP}_tarball.tar.gz INFO_TARGET=\${DIR}/.zdegit readonly TARBALL_TARGET=\${DIR}/\${TEMP}_tarball.tar.gz INFO_TARGET=\${DIR}/.zdegit
@ -503,7 +504,6 @@ print_okay() {
} }
download_tarball() { download_tarball() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local host repo local host repo
if [[ \${URL} =~ ^([^:@/]+://)?([^@]+@)?([^:/]+)[:/]([^/]+/[^/]+)/?\$ ]]; then if [[ \${URL} =~ ^([^:@/]+://)?([^@]+@)?([^:/]+)[:/]([^/]+/[^/]+)/?\$ ]]; then
host=\${match[3]} host=\${match[3]}
@ -625,6 +625,7 @@ case \${ACTION} in
esac esac
" ;; " ;;
git) zcmd="# This runs in a new shell git) zcmd="# This runs in a new shell
builtin emulate -L zsh
readonly -i PRINTLEVEL=\${1} readonly -i PRINTLEVEL=\${1}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} TYPE=\${6:=branch} SUBMODULES=1 readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} TYPE=\${6:=branch} SUBMODULES=1
REV=\${7} REV=\${7}
@ -718,6 +719,8 @@ esac
} }
zimfw() { zimfw() {
builtin emulate -L zsh
setopt EXTENDED_GLOB
local -r _zversion='1.6.2-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='1.6.2-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions: