=== modified file 'zsh-functions/confz_fileset_init' --- zsh-functions/confz_fileset_init 2016-03-15 13:50:30 +0000 +++ zsh-functions/confz_fileset_init 2016-03-15 13:32:29 +0000 @@ -19,20 +19,20 @@ 1 p # FIFO pipe ) -typeset -g -A fileset_stat_cache fileset_stat_cur +typeset -g -A fileset_stat_cache typeset -g fileset_stat_cur fileset_stat_next_id fileset_stat_cur_type fileset_stat_cur_perm fileset_reset_cache(){ # omit unsetting used variables for now # probably no particular gain in freeing them - fileset_stat_cache=() - fileset_stat_cur=() + fileset_stat=() + fileset_stat_cur= fileset_stat_next_id=1 } fileset_reset_cache # runs zstat on $1 if not already in cache -# the result is available as $fileset_stat_cur associative array +# the result is available as ${(P)fileset_stat_cur} fileset_stat() { local id ret ftype fperm id=${fileset_stat_cache[$1]:-missing} @@ -56,12 +56,10 @@ } fileset_stat_set_cur(){ - local param - param=fileset_stat_$1 - fileset_stat_cur=( "${(@kvP)param}" ) - ftype=$[ [##16] $fileset_stat_cur[mode] >> 12 ] + fileset_stat_cur=fileset_stat_$1 + ftype=$[ [##16] ${${(P)fileset_stat_cur}[mode]} >> 12 ] fileset_stat_cur_type=$fileset_ftypes[$ftype] - fileset_stat_cur_perm=$[ [##8] $fileset_stat_cur[mode] & 4095 ] + fileset_stat_cur_perm=$[ [##8] ${${(P)fileset_stat_cur}[mode]} & 4095 ] } fileset_resetcmd() { @@ -122,7 +120,7 @@ fileset_stat $vars[filename] && \ [[ $fileset_stat_cur_type == L ]] && \ - [[ $fileset_stat_cur[link] == $vars[destination] ]] + [[ ${${(P)fileset_stat_cur}[link]} == $vars[destination] ]] } confz_fs_l_do() { @@ -158,10 +156,10 @@ die "fs_o: could not access file ${(qqq)vars[filename]}" if [[ $vars[owner] =~ '^[0-7]+:[0-7]+$' ]]; then - (( $fileset_stat_cur[uid] == ${${vars[owner]}%:*} && \ - $fileset_stat_cur[gid] == ${${vars[owner]}#*:} )) + (( ${${(P)fileset_stat_cur}[uid]} == ${${vars[owner]}%:*} && \ + ${${(P)fileset_stat_cur}[gid]} == ${${vars[owner]}#*:} )) elif [[ $vars[owner] =~ '^[0-7]+$' ]]; then - (( $fileset_stat_cur[uid] == ${${vars[owner]}%:*} )) + (( ${${(P)fileset_stat_cur}[uid]} == ${${vars[owner]}%:*} )) else die "fs_o does not support non-numeric user/group: ${(qqq)vars[owner]}" fi