From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.229.71 with SMTP id jh7cs178362icb; Wed, 19 Jan 2011 10:53:57 -0800 (PST) Received: by 10.42.167.9 with SMTP id q9mr1350263icy.1.1295463237185; Wed, 19 Jan 2011 10:53:57 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 6si14941518qcc.37.2011.01.19.10.53.56; Wed, 19 Jan 2011 10:53:57 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 859EC1858379; Wed, 19 Jan 2011 13:53:56 -0500 (EST) Received: from www.cquest.utoronto.ca (www.cquest.utoronto.ca [192.82.128.5]) by rubyforge.org (Postfix) with ESMTP id 68AA7185834E for ; Wed, 19 Jan 2011 13:41:22 -0500 (EST) Received: from pinkfloyd.chass.utoronto.ca ([128.100.160.254]:60262 ident=93) by www.cquest.utoronto.ca with esmtp (Exim 4.43) id 1Pfcy9-0001Pp-7g for sup-devel@rubyforge.org; Wed, 19 Jan 2011 13:41:21 -0500 Received: from bwalton by pinkfloyd.chass.utoronto.ca with local (Exim 4.72) (envelope-from ) id 1Pfcy9-0000ma-6p for sup-devel@rubyforge.org; Wed, 19 Jan 2011 13:41:21 -0500 From: Ben Walton To: sup-devel In-reply-to: <1295457514-sup-3702@masanjin.net> References: <1295375324-2496-1-git-send-email-sascha-pgp@silbe.org> <1295375324-2496-2-git-send-email-sascha-pgp@silbe.org> <1295451265-sup-1883@masanjin.net> <1295457514-sup-3702@masanjin.net> Date: Wed, 19 Jan 2011 13:41:21 -0500 Message-Id: <1295462152-sup-1745@pinkfloyd.chass.utoronto.ca> User-Agent: Sup/git Subject: Re: [sup-devel] [PATCH 2/2] {config, sources}.yaml: preserve symlinks and permissions X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org Excerpts from William Morgan's message of Wed Jan 19 12:19:11 -0500 2011: > Actually, I think it should be: > > if File.exists?(fn) && File.size(fn) > 0 How about: begin fninf = File.stat(fn) if fninf.size? ... rescue Errno::ENOENT => e ... end I didn't look at the surrounding code so I'm not sure how to best integrate this. The advantage is that you save one user->kernel space traversal. Calling .exists? and .size via File results in two stat() calls. Grabbing and saving the actual stat result on the first call and then using them for further tests saves this. Not a huge overhead, I admit... HTH. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel