From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2434 invoked by alias); 14 Dec 2016 14:23:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40183 Received: (qmail 21167 invoked from network); 14 Dec 2016 14:23:47 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(133.208.98.4):SA:0(-3.8/5.0):. Processed in 1.5148 secs); 14 Dec 2016 14:23:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf01.biglobe.ne.jp designates 133.208.98.4 as permitted sender) X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: caching mechanism and Re: PATCH Completion for _yum From: "Jun T." In-Reply-To: <19089.1481715508@hydra.kiddle.eu> Date: Wed, 14 Dec 2016 23:23:41 +0900 Content-Transfer-Encoding: 7bit Message-Id: References: <61b3fb7c-4de6-d8da-29b4-b3802d98b162@mathphys.fsk.uni-heidelberg.de> <20161027013054.GA15799@fujitsu.shahaf.local2> <484fa75d-9361-df92-06b4-54fad37231f4@mathphys.fsk.uni-heidelberg.de> <98208.1478792966@hydra.kiddle.eu> <765413af-36a5-9afb-dd8a-7e1a39d05dde@mathphys.fsk.uni-heidelberg.de> <31607.1478915523@hydra.kiddle.eu> <75905.1479841546@hydra.kiddle.eu> <6472.1481623850@hydra.kiddle.eu> <161213083842.ZM21919@torch.brasslantern.com> <161213092141.ZM22063@torch.brasslantern.com> <19089.1481715508@hydra.kiddle.eu> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.1878.6) X-Biglobe-Spnum: 61217 2016/12/14 20:38, Oliver Kiddle wrote: > "Jun T." wrote: > >>>> if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && >>>> ! _retrieve_cache dputhosts; then >>>> - which makes no sense to me. > >> I guess what is intended by the original code is to be sure to >> regenerate >> the data if the cache is invalid, even if the variable _dput_cfhosts >> already exists in the current zsh. > > That's not what that logic does though. Simplify the line to > if ( blah blah... ) && ! _retrieve_cache dputhosts > > and you will see that it only regenerates the cache if _retrieve_cache > fails. In practice the effect is that no cache is ever considered stale. E = _dput_cfhosts exists I = _cache_invalid R = _retrieve_cache orig = (!E or I) and !R new = !E and (I or !R) !E I !R orig new T T T T T T T F F T (1) T F T T T T F F F F F T T T F (2) F T F F F F F T F F F F F F F If _cache_invalid returns 0, then _retrieve_cache should return 1 (we can't retrieve from an invalid cache, unless another zsh has refreshed the cache between the two calls). So the case (1) above is impossible, and the only difference is the case (2), i.e., _dput_cfhosts exists but cache is invalid (and _retrieve_cache returns 1). Jun