From 6dbf2f2f4a97e2831094a73c662484ce990e7e41 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Sun, 2 Nov 2008 14:12:29 +0000 Subject: 25988: declare temporary cache array as local, thanks to problem noticed by Kazuhiro NISHIYAMA. --- ChangeLog | 13 +++++++++++++ Completion/Darwin/Command/_fink | 1 + Completion/Darwin/Type/_retrieve_mac_apps | 7 ++++--- Completion/Debian/Command/_apt | 14 +++++++------- Completion/Debian/Type/_deb_packages | 17 +++++++++-------- Completion/Redhat/Command/_rpm | 1 + Completion/Redhat/Command/_yum | 23 ++++++++++++----------- Completion/Unix/Command/_bogofilter | 1 + Completion/Unix/Type/_path_commands | 4 ++-- Completion/Unix/Type/_perl_modules | 1 + Doc/Zsh/compsys.yo | 1 + 11 files changed, 52 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index acd225ff6..fbdb631ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-11-02 Clint Adams + + * 25988: Completion/Darwin/Command/_fink, + Completion/Darwin/Type/_retrieve_mac_apps, + Completion/Debian/Command/_apt, + Completion/Debian/Type/_deb_packages, + Completion/Redhat/Command/_rpm, Completion/Redhat/Command/_yum, + Completion/Unix/Command/_bogofilter, + Completion/Unix/Type/_path_commands, + Completion/Unix/Type/_perl_modules, Doc/Zsh/compsys.yo: declare + temporary cache array as local, thanks to problem noticed by + Kazuhiro NISHIYAMA. + 2008-11-01 Clint Adams * 25987: Src/Modules/tcp.c: don't ztrdup the buffer returned by diff --git a/Completion/Darwin/Command/_fink b/Completion/Darwin/Command/_fink index f0ff6834e..27ca3740c 100644 --- a/Completion/Darwin/Command/_fink +++ b/Completion/Darwin/Command/_fink @@ -55,6 +55,7 @@ _fink_get_packages(){ } _finkpkgs_caching_policy(){ + local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) || [[ /sw/var/cache/apt/pkgcache.bin -nt "$1" ]] || diff --git a/Completion/Darwin/Type/_retrieve_mac_apps b/Completion/Darwin/Type/_retrieve_mac_apps index f435fde26..e9a30e006 100644 --- a/Completion/Darwin/Type/_retrieve_mac_apps +++ b/Completion/Darwin/Type/_retrieve_mac_apps @@ -4,9 +4,10 @@ # Used by _mac_applications and _mac_files_for_application. _mac_apps_caching_policy () { - # Rebuild if cache is more than a day old - oldp=( "$1"(Nmw+1) ) - (( $#oldp )) + # Rebuild if cache is more than a day old + local -a oldp + oldp=( "$1"(Nmw+1) ) + (( $#oldp )) } diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index c22e42ecb..bdcfcd26a 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -571,14 +571,14 @@ _apt_releases () { _tags apt-releases && compadd -a _apt_releases } - _apt_caching_policy () { - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 +_apt_caching_policy () { + local -a oldp - [[ /var/cache/apt/pkgcache.bin -nt "$1" || - /var/lib/dpkg/available -nt "$1" ]] - } + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 + [[ /var/cache/apt/pkgcache.bin -nt "$1" || + /var/lib/dpkg/available -nt "$1" ]] +} _apt "$@" diff --git a/Completion/Debian/Type/_deb_packages b/Completion/Debian/Type/_deb_packages index 8ddf0e959..dea50cfdc 100644 --- a/Completion/Debian/Type/_deb_packages +++ b/Completion/Debian/Type/_deb_packages @@ -108,13 +108,14 @@ _deb_packages () { _tags packages && compadd "$expl[@]" - "${(@P)cachevar}" } - _debs_caching_policy () { - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 - - [[ /var/cache/apt/pkgcache.bin -nt "$1" || - /var/lib/dpkg/available -nt "$1" ]] - } +_debs_caching_policy () { + # rebuild if cache is more than a week old + local -a oldp + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 + + [[ /var/cache/apt/pkgcache.bin -nt "$1" || + /var/lib/dpkg/available -nt "$1" ]] +} _deb_packages "$@" diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm index 140f5313f..184d7b00d 100644 --- a/Completion/Redhat/Command/_rpm +++ b/Completion/Redhat/Command/_rpm @@ -314,6 +314,7 @@ fi _rpms_caching_policy () { # rebuild if cache is more than a week old + local -a oldp oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum index 8988b43d7..455812b1b 100644 --- a/Completion/Redhat/Command/_yum +++ b/Completion/Redhat/Command/_yum @@ -274,21 +274,22 @@ _yum_list_or_info() _yum_caching_policy() { - local _yumrepomds + local _yumrepomds + local -a oldp - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 + # rebuild if cache is more than a week old + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 - _yumrepomds=( /var/cache/yum/**/repomd.xml ) + _yumrepomds=( /var/cache/yum/**/repomd.xml ) - if (( $#_yumrepomds )); then - for repo in $_yumrepomds; do - [[ "$repo" -nt "$1" ]] && return 0 - done - fi + if (( $#_yumrepomds )); then + for repo in $_yumrepomds; do + [[ "$repo" -nt "$1" ]] && return 0 + done + fi - return 1 + return 1 } _yum "$@" diff --git a/Completion/Unix/Command/_bogofilter b/Completion/Unix/Command/_bogofilter index 9e6ac3f88..980d3155e 100644 --- a/Completion/Unix/Command/_bogofilter +++ b/Completion/Unix/Command/_bogofilter @@ -3,6 +3,7 @@ local expl ret bogotokens _bogoutil_caching_policy () { + local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 340a013c3..393c0c67e 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -3,8 +3,8 @@ (( $+functions[_path_commands_caching_policy] )) || _path_commands_caching_policy() { -local oldp file -typeset -a dbfiles +local file +local -a oldp dbfiles # rebuild if cache is more than a week old oldp=( "$1"(Nmw+1) ) diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules index 00629335b..26cab0c23 100644 --- a/Completion/Unix/Type/_perl_modules +++ b/Completion/Unix/Type/_perl_modules @@ -132,6 +132,7 @@ _perl_modules () { _perl_modules_caching_policy () { local _perllocals + local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 825c441e3..be78b0aa2 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3906,6 +3906,7 @@ Example: example(_example_caching_policy () { # rebuild if cache is more than a week old + local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) }) -- cgit 1.4.1