* ZSH 3.0.5 breaks script
@ 1997-09-30 12:28 Andrej Borsenkow
1997-09-30 15:13 ` BUG in rcexpandparam? (was: ZSH 3.0.5 breaks script) Andrej Borsenkow
0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 1997-09-30 12:28 UTC (permalink / raw)
To: Zsh workers mailing list
Hi!
I installed 3.0.5, and since then my script for cd completion doesn't
work. I wrote it long ago (pre 3.x.x) and never changed since then (I
know, it could look better ... ;)
Currently I get:
bor@itsmx1:~%> cdTAB
bor@itsmx1:~%> cd ${temp_reply}/
instead of listing choices.
setopt gives:
autoparamslash
autoremoveslash
nobanghist
nobeep
extendedglob
histignoredups
ignoreeof
interactive
nolistbeep
listtypes
login
magicequalsubst
menucomplete
monitor
nonomatch
numericglobsort
shinstdin
zle
compctl for cd is:
cd -qUQ -K multi_cd_comp -S /
where multi_cd_comp is
local pref head sofar origtop newtop globdir="(-/)" wild cdpath_dirs i origpref temp_reply
setopt localoptions nullglob rcexpandparam globdots
unsetopt markdirs globsubst shwordsplit
pref="${1}$2"
# Hack to allow programmable completion to select multicomp after a :
# (e.g.
# compctl -D -f -x 's[:]' -U -K multicomp
# )
pref="${pref#:}"
origpref="${pref}"
if [[ "$pref" == [/\~]* ]]; then
cdpath_dirs=('')
else
cdpath_dirs=("${cdpath[@]:-''}")
fi
reply=()
temp_reply=('')
for i in "${cdpath_dirs[@]}"; do
sofar=('')
origtop=""
if [[ -n "${i}" ]]; then
pref=${i}/${origpref}
else
pref=${origpref}
fi
if [[ "$pref" = \~* ]]; then
# If the string started with ~, save the head and what it will become.
origtop="${pref%%/*}"
newtop=${~origtop}
# Save the expansion as the bit matched already
sofar=($newtop)
pref="${pref#$origtop}"
fi
while [[ -n "$pref" ]]; do
[[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}"
head="${pref%%/*}"
pref="${pref#$head}"
if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then
# Exactly matched directory: don't try to glob
temp_reply=("${sofar}$head")
else
# if path segment contains wildcards, don't add another.
if [[ "$head" = *[\*\?]* ]]; then
wild=
else
wild='*'
fi
temp_reply=(${sofar}"${head}${wild}${globdir}")
temp_reply=(${~temp_reply})
fi
[[ -z $temp_reply[1] ]] && temp_reply=() && break
[[ -n $pref ]] && sofar=($temp_reply)
done
# Restore ~'s in front if there were any.
# There had better not be anything funny in $newtop.
[[ -n "${i}" ]] && temp_reply=(${temp_reply#${i}/})
if [[ -n "$origtop" ]]; then
reply=(${reply} "$origtop"${temp_reply#$newtop})
else
reply=(${reply} ${temp_reply})
fi
done
What's wrong?
-------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 252 01 05
SNI ITS Moscow Tel: +7 (095) 252 13 88
NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* BUG in rcexpandparam? (was: ZSH 3.0.5 breaks script)
1997-09-30 12:28 ZSH 3.0.5 breaks script Andrej Borsenkow
@ 1997-09-30 15:13 ` Andrej Borsenkow
0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1997-09-30 15:13 UTC (permalink / raw)
To: Zsh workers mailing list
Sorry for previous long posting, but I suddenly got a couple of minutes
...
So, here is the file "foo":
setopt rcexpandparam
bar=()
bar=(${bar} ${foo})
echo $bar
zsh -f foo ->
${foo} !!!!
without rcexpandparam all works quite fine. Also, "bar" _must_ be set to
null array before; if I set it to anything else (including ''), ${foo}
goes away.
Either something is wrong with bar=() or with rcexpandparam?
-------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 252 01 05
SNI ITS Moscow Tel: +7 (095) 252 13 88
NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: BUG in rcexpandparam? (was: ZSH 3.0.5 breaks script)
@ 1997-09-30 16:29 Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1997-09-30 16:29 UTC (permalink / raw)
To: Zsh hackers list
Andrej Borsenkow wrote:
> Either something is wrong with bar=() or with rcexpandparam?
aha, that's the key to the bug I posted a few weeks ago.
% fn() { =ls $* }
% fn
zsh: command not found: =ls
% unsetopt rcexpandparam
% fn
<works OK>
The $* here is required to make it fail.
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-09-30 16:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-30 12:28 ZSH 3.0.5 breaks script Andrej Borsenkow
1997-09-30 15:13 ` BUG in rcexpandparam? (was: ZSH 3.0.5 breaks script) Andrej Borsenkow
1997-09-30 16:29 Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).