Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-4.3.2 fails to run .zcompdump when an "alias -g" is in it



On 2007-06-05 at 21:58 +0000, Zrajm C Akfohg wrote:
[ zcompdump broken ]
> Today I realized that this might have something with the global alias "cp" that
> I have. And sure enough, if I remove the line
> 
>      alias -g cp='cp -b'
> 
> from my .zshrc the problem goes away.

> the problem goes away completely. -- Until zsh generates a new (faulty)
> .zcompdump file.
> 
> Thus, zsh should generate a .zcompdump file in which the keys in all
> associative arrays are quoted, to avoid having them expanded as aliases.

Try this; fortunately, it's an easy change: the parameter expansion flag
'q' can be doubled to use single-quote quoting instead of backslash
escaping.

-Phil
Index: Completion/compdump
===================================================================
RCS file: /home/cvsroot/zsh/Completion/compdump,v
retrieving revision 1.7
diff -p -u -r1.7 compdump
--- Completion/compdump	16 Jun 2004 15:10:21 -0000	1.7
+++ Completion/compdump	5 Jun 2007 22:55:46 -0000
@@ -41,32 +41,32 @@ print "#files: $#_d_files\tversion: $ZSH
 
 print "\n_comps=(" >> $_d_file
 for _d_f in ${(ok)_comps}; do
-  print -r - "${(q)_d_f}" "${(q)_comps[$_d_f]}"
+  print -r - "${(qq)_d_f}" "${(qq)_comps[$_d_f]}"
 done >> $_d_file
 print ")" >> $_d_file
 
 print "\n_services=(" >> $_d_file
 for _d_f in ${(ok)_services}; do
-  print -r - "${(q)_d_f}" "${(q)_services[$_d_f]}"
+  print -r - "${(qq)_d_f}" "${(qq)_services[$_d_f]}"
 done >> $_d_file
 print ")" >> $_d_file
 
 print "\n_patcomps=(" >> $_d_file
 for _d_f in ${(ok)_patcomps}; do
-  print -r - "${(q)_d_f}" "${(q)_patcomps[$_d_f]}"
+  print -r - "${(qq)_d_f}" "${(qq)_patcomps[$_d_f]}"
 done >> $_d_file
 print ")" >> $_d_file
 
 _d_tmp="_postpatcomps"
 print "\n_postpatcomps=(" >> $_d_file
 for _d_f in ${(ok)_postpatcomps}; do
-  print -r - "${(q)_d_f}" "${(q)_postpatcomps[$_d_f]}"
+  print -r - "${(qq)_d_f}" "${(qq)_postpatcomps[$_d_f]}"
 done >> $_d_file
 print ")" >> $_d_file
 
 print "\n_compautos=(" >> $_d_file
 for _d_f in "${(ok@)_compautos}"; do
-  print -r - "${(q)_d_f}" "${(q)_compautos[$_d_f]}"
+  print -r - "${(qq)_d_f}" "${(qq)_compautos[$_d_f]}"
 done >> $_d_file
 print ")" >> $_d_file
 
@@ -129,7 +129,7 @@ done
 print >> $_d_file
 
 print "typeset -gUa _comp_assocs" >> $_d_file
-print "_comp_assocs=( ${(q)_comp_assocs} )" >> $_d_file
+print "_comp_assocs=( ${(qq)_comp_assocs} )" >> $_d_file
 
 mv $_d_file ${_d_file%.$HOST.$$}
 


Messages sorted by: Reverse Date, Date, Thread, Author