From owner-freebsd-ruby@FreeBSD.ORG Sat Jan 2 03:12:01 2010 Return-Path: Delivered-To: ruby@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE5DB1065694 for ; Sat, 2 Jan 2010 03:12:01 +0000 (UTC) (envelope-from oscartheduck@gmail.com) Received: from mail-gx0-f218.google.com (mail-gx0-f218.google.com [209.85.217.218]) by mx1.freebsd.org (Postfix) with ESMTP id 681048FC13 for ; Sat, 2 Jan 2010 03:12:01 +0000 (UTC) Received: by gxk10 with SMTP id 10so13101358gxk.3 for ; Fri, 01 Jan 2010 19:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type :content-transfer-encoding:subject:date:message-id:to:mime-version :x-mailer; bh=XyJkdO6Yw2Cc3XYN0kT3SzGJnmZJILTAFvSz9YCtrvg=; b=NZaoatxm5oT8gqiSAOG5WZUnJRniFjgyM24JpyrHP5gqMWfEKTfdTxWhaGkrHNjbI8 snjuwc8vZ9rnBqqJLo9pgGu8xgTv1zDGs0t+wpqqvis+PkcAFMqYvA3aCY5nEin+1uNE azX6ZDCgL5MG8vgstC9WxpDdAaGOX1Encj/R4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; b=E9jtaDmfFHMhXu/E+y+uWT5wn0uPk5usbSc6MM3oEpD+QJf/fikm/cTVExx3DqlTs+ bjOnO4DeAprM1zjC3p39i0wDcS/qlmyISwqXqG40SH+a/MUEBY0ptURJdzxTBEQEltG5 A388vl3c5Vio44QGS56MnMxEAT6esEOKelfHk= Received: by 10.150.29.40 with SMTP id c40mr4560652ybc.234.1262401916834; Fri, 01 Jan 2010 19:11:56 -0800 (PST) Received: from ?192.168.1.4? (c-71-196-193-228.hsd1.co.comcast.net [71.196.193.228]) by mx.google.com with ESMTPS id 20sm15241826iwn.1.2010.01.01.19.11.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 01 Jan 2010 19:11:55 -0800 (PST) From: James Harrison Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 1 Jan 2010 20:11:52 -0700 Message-Id: <70626630-CEF2-40DA-853E-82FBE5CB9487@gmail.com> To: ruby@freebsd.org Mime-Version: 1.0 (Apple Message framework v1077) X-Mailer: Apple Mail (2.1077) Cc: Subject: portupgrade code question X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 03:12:01 -0000 Hey folks, I've been reading the code for portupgrade and have come across = something I don't understand at all. In the lib/portsdb.rb, the glob method starts on line 757. On line 773, as part of the glob method, we have the following: <---snip---> # shortcut if portinfo =3D port(pattern) if block_given? yield(portinfo) return nil else return [portinfo] end end end <---/snip---> Won't the condition "if portinfo =3D port(pattern)" always evaluate to = true, as it's an assignation not a test? Is it meant to read if portinfo = =3D=3D port(pattern)? If so, there are then a fair few tests which use =3D instead of =3D=3D If not, what's the purpose? Thanks! James= From owner-freebsd-ruby@FreeBSD.ORG Sat Jan 2 10:40:12 2010 Return-Path: Delivered-To: ruby@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB47106568F; Sat, 2 Jan 2010 10:40:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E932B8FC18; Sat, 2 Jan 2010 10:40:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o02AeB6h054233; Sat, 2 Jan 2010 10:40:11 GMT (envelope-from edwin@freefall.freebsd.org) Received: (from edwin@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o02AeBM9054229; Sat, 2 Jan 2010 10:40:11 GMT (envelope-from edwin) Date: Sat, 2 Jan 2010 10:40:11 GMT Message-Id: <201001021040.o02AeBM9054229@freefall.freebsd.org> To: edwin@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org, ruby@FreeBSD.org From: edwin@FreeBSD.org Cc: Subject: Re: ports/142231: [Update]math/ruby-narray:update to 0.5.9p7 X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 10:40:12 -0000 Synopsis: [Update]math/ruby-narray:update to 0.5.9p7 Responsible-Changed-From-To: freebsd-ports-bugs->ruby Responsible-Changed-By: edwin Responsible-Changed-When: Sat Jan 2 10:40:11 UTC 2010 Responsible-Changed-Why: Over to maintainer (via the GNATS Auto Assign Tool) http://www.freebsd.org/cgi/query-pr.cgi?pr=142231 From owner-freebsd-ruby@FreeBSD.ORG Sat Jan 2 18:39:04 2010 Return-Path: Delivered-To: ruby@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAA541065676 for ; Sat, 2 Jan 2010 18:39:04 +0000 (UTC) (envelope-from knu@iDaemons.org) Received: from mail.musha.org (v055125.ppp.asahi-net.or.jp [124.155.55.125]) by mx1.freebsd.org (Postfix) with ESMTP id 482228FC08 for ; Sat, 2 Jan 2010 18:39:04 +0000 (UTC) Received: from daemon.musha.org (daemon.local.idaemons.org [192.168.11.11]) by mail.musha.org (Postfix) with ESMTP id 6A6AF93CFB; Sun, 3 Jan 2010 03:22:36 +0900 (JST) Date: Sun, 03 Jan 2010 03:22:36 +0900 Message-ID: <86my0w2wpf.knu@iDaemons.org> From: "Akinori MUSHA" To: James Harrison In-Reply-To: <70626630-CEF2-40DA-853E-82FBE5CB9487@gmail.com> References: <70626630-CEF2-40DA-853E-82FBE5CB9487@gmail.com> Organization: Associated I. Daemons X-PGP-Public-Key: finger knu@FreeBSD.org X-PGP-Fingerprint: 081D 099C 1705 861D 4B70 B04A 920B EFC7 9FD9 E1EE MIME-Version: 1.0 (generated by EMIKO 1.14.1 - "Choanoflagellata") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Sun_Jan__3_03:22:36_2010-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Cc: ruby@freebsd.org Subject: Re: portupgrade code question X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 18:39:04 -0000 --pgp-sign-Multipart_Sun_Jan__3_03:22:36_2010-1 Content-Type: text/plain; charset=US-ASCII At Fri, 1 Jan 2010 20:11:52 -0700, James Harrison wrote: > I've been reading the code for portupgrade and have come across something I don't understand at all. > > In the lib/portsdb.rb, the glob method starts on line 757. > > On line 773, as part of the glob method, we have the following: > > <---snip---> > # shortcut > if portinfo = port(pattern) > if block_given? > yield(portinfo) > return nil > else > return [portinfo] > end > end > end > <---/snip---> > > Won't the condition "if portinfo = port(pattern)" always evaluate to true, as it's an assignation not a test? Is it meant to read if portinfo == port(pattern)? What made you think port(pattern) always evaluates to true? Whenever a given pattern does not match anything port() returns a false value (nil). When a given pattern represents an exact port there is no need to perform further pattern matching. That is the intention, a "shortcut". -- Akinori MUSHA / http://akinori.org/ --pgp-sign-Multipart_Sun_Jan__3_03:22:36_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEABECAAYFAks/juwACgkQkgvvx5/Z4e668QCeNbuc6AbeEVo/ResbP/64az30 N+MAoITZyI4x/rgaAd9u8QvH4sZbRncN =XmQQ -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sun_Jan__3_03:22:36_2010-1--