1
0
Fork 0
mirror of synced 2024-11-22 15:25:34 -05:00

Quote path names in init.zsh

to properly handle path names with spaces.
Fixes #497
This commit is contained in:
Eric Nielsen 2023-02-16 07:47:42 -05:00
parent d10d7c627c
commit f71bff5418
No known key found for this signature in database
GPG key ID: 678AF5E338C87D99
5 changed files with 20 additions and 18 deletions

View file

@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
_No unreleased changes._
### Fixed
- Quote path names in init.zsh to properly handle path names with spaces.
## [1.11.1] - 2023-02-04

View file

@ -5,8 +5,8 @@ _zimfw_build_init() {
command mv -f ${ztarget}{,.old} || return 1
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local zroot_dir zpre
local -a zif_functions zif_cmds zroot_functions zroot_cmds
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
@ -22,7 +22,7 @@ _zimfw_build_init() {
fi
done
zpre=$'*\0'
if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfpaths} )) print 'fpath=('${(q-)${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
for zroot_dir in ${_zroot_dirs}; do
zpre=${zroot_dir}$'\0'

View file

@ -179,11 +179,11 @@ Per-call initialization options:
shift
zarg=${1}
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
zcmds+=("source ${zarg:A}")
zcmds+=("source ${(q-)zarg:A}")
;;
-c|--cmd)
shift
zcmds+=(${1//{}/${zroot_dir:A}})
zcmds+=(${1//{}/${(q-)zroot_dir:A}})
;;
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
*)
@ -211,11 +211,11 @@ Per-call initialization options:
local -ra prezto_scripts=(${zroot_dir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zcmds=('source '${^prezto_scripts:A})
zcmds=('source '${(q-)^prezto_scripts:A})
else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=('source '${^zscripts:A})
zcmds=('source '${(q-)^zscripts:A})
fi
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then

View file

@ -1,7 +1,7 @@
# This runs in a new shell
builtin emulate -L zsh -o EXTENDED_GLOB
readonly -i PRINTLEVEL=${1} SUBMODULES=${8}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} ONPULL=${9} TEMP=.zdegit_${RANDOM}
readonly ACTION=${2} MODULE=${3} DIR=${4} URL=${5} REV=${7} ONPULL=${9} TEMP=.zdegit_${sysparams[pid]}
readonly TARBALL_TARGET=${DIR}/${TEMP}_tarball.tar.gz INFO_TARGET=${DIR}/.zdegit
print_error() {

View file

@ -57,8 +57,8 @@ _zimfw_build_init() {
command mv -f ${ztarget}{,.old} || return 1
fi
_zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zimfw() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${(q-)ZIM_HOME}/zimfw.zsh \"\${@}\" }"
local zroot_dir zpre
local -a zif_functions zif_cmds zroot_functions zroot_cmds
local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds})
@ -74,7 +74,7 @@ _zimfw_build_init() {
fi
done
zpre=$'*\0'
if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfpaths} )) print 'fpath=('${(q-)${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}}
for zroot_dir in ${_zroot_dirs}; do
zpre=${zroot_dir}$'\0'
@ -292,11 +292,11 @@ Per-call initialization options:
shift
zarg=${1}
if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg}
zcmds+=("source ${zarg:A}")
zcmds+=("source ${(q-)zarg:A}")
;;
-c|--cmd)
shift
zcmds+=(${1//{}/${zroot_dir:A}})
zcmds+=(${1//{}/${(q-)zroot_dir:A}})
;;
-d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;;
*)
@ -324,11 +324,11 @@ Per-call initialization options:
local -ra prezto_scripts=(${zroot_dir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zcmds=('source '${^prezto_scripts:A})
zcmds=('source '${(q-)^prezto_scripts:A})
else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=('source '${^zscripts:A})
zcmds=('source '${(q-)^zscripts:A})
fi
fi
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
@ -454,7 +454,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2023-02-04 14:46:47 UTC, previous commit is 7778e97)'
print -R 'zimfw version: '${_zversion}' (built at 2023-02-16 12:44:26 UTC, previous commit is fae0a7e)'
print -R 'OSTYPE: '${OSTYPE}
print -R 'TERM: '${TERM}
print -R 'TERM_PROGRAM: '${TERM_PROGRAM}
@ -584,7 +584,7 @@ _zimfw_run_tool() {
degit) zcmd="# This runs in a new shell
builtin emulate -L zsh -o EXTENDED_GLOB
readonly -i PRINTLEVEL=\${1} SUBMODULES=\${8}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} ONPULL=\${9} TEMP=.zdegit_\${RANDOM}
readonly ACTION=\${2} MODULE=\${3} DIR=\${4} URL=\${5} REV=\${7} ONPULL=\${9} TEMP=.zdegit_\${sysparams[pid]}
readonly TARBALL_TARGET=\${DIR}/\${TEMP}_tarball.tar.gz INFO_TARGET=\${DIR}/.zdegit
print_error() {