From owner-freebsd-ports@freebsd.org Thu Sep 21 00:11:07 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FF81E03FE2; Thu, 21 Sep 2017 00:11:07 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C3AFBE3; Thu, 21 Sep 2017 00:11:07 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v8L0AUCY007444 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 20 Sep 2017 17:10:30 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v8L0AU7S007443; Wed, 20 Sep 2017 17:10:30 -0700 (PDT) (envelope-from sgk) Date: Wed, 20 Sep 2017 17:10:30 -0700 From: Steve Kargl To: freebsd-ports@freebsd.org, freebsd-python@freebsd.org Subject: namespace pollution with entities in math.h Message-ID: <20170921001030.GA7423@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Sep 2017 00:11:07 -0000 It seems that I accidentally stumped onto namespace pollution in lang/python36, which is identical to the same issue I came across with lang/python27 and reported several weeks ago. The following diff fixes both ports. Index: lang/python27/files/patch-Modules__mathmodule.c =================================================================== --- lang/python27/files/patch-Modules__mathmodule.c (nonexistent) +++ lang/python27/files/patch-Modules__mathmodule.c (working copy) @@ -0,0 +1,38 @@ +--- Modules/mathmodule.c.orig 2017-09-15 11:14:58.388892000 -0700 ++++ Modules/mathmodule.c 2017-09-15 11:15:38.636909000 -0700 +@@ -71,7 +71,7 @@ + static const double sqrtpi = 1.772453850905516027298167483341145182798; + + static double +-sinpi(double x) ++_sinpi(double x) + { + double y, r; + int n; +@@ -270,7 +270,7 @@ + integer. */ + if (absx > 200.0) { + if (x < 0.0) { +- return 0.0/sinpi(x); ++ return 0.0/_sinpi(x); + } + else { + errno = ERANGE; +@@ -294,7 +294,7 @@ + } + z = z * lanczos_g / y; + if (x < 0.0) { +- r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); ++ r = -pi / _sinpi(absx) / absx * exp(y) / lanczos_sum(absx); + r -= z * r; + if (absx < 140.0) { + r /= pow(y, absx - 0.5); +@@ -366,7 +366,7 @@ + (x-0.5)*(log(x+lanczos_g-0.5)-1); + } + else { +- r = log(pi) - log(fabs(sinpi(absx))) - log(absx) - ++ r = log(pi) - log(fabs(_sinpi(absx))) - log(absx) - + (log(lanczos_sum(absx)) - lanczos_g + + (absx-0.5)*(log(absx+lanczos_g-0.5)-1)); + } Property changes on: lang/python27/files/patch-Modules__mathmodule.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: lang/python36/files/patch-Modules__mathmodule.c =================================================================== --- lang/python36/files/patch-Modules__mathmodule.c (nonexistent) +++ lang/python36/files/patch-Modules__mathmodule.c (working copy) @@ -0,0 +1,38 @@ +--- Modules/mathmodule.c.orig 2017-09-15 13:33:29.735199000 -0700 ++++ Modules/mathmodule.c 2017-09-15 13:33:48.030737000 -0700 +@@ -67,7 +67,7 @@ + static const double logpi = 1.144729885849400174143427351353058711647; + + static double +-sinpi(double x) ++_sinpi(double x) + { + double y, r; + int n; +@@ -296,7 +296,7 @@ + integer. */ + if (absx > 200.0) { + if (x < 0.0) { +- return 0.0/sinpi(x); ++ return 0.0/_sinpi(x); + } + else { + errno = ERANGE; +@@ -320,7 +320,7 @@ + } + z = z * lanczos_g / y; + if (x < 0.0) { +- r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); ++ r = -pi / _sinpi(absx) / absx * exp(y) / lanczos_sum(absx); + r -= z * r; + if (absx < 140.0) { + r /= pow(y, absx - 0.5); +@@ -390,7 +390,7 @@ + r += (absx - 0.5) * (log(absx + lanczos_g - 0.5) - 1); + if (x < 0.0) + /* Use reflection formula to get value for negative x. */ +- r = logpi - log(fabs(sinpi(absx))) - log(absx) - r; ++ r = logpi - log(fabs(_sinpi(absx))) - log(absx) - r; + if (Py_IS_INFINITY(r)) + errno = ERANGE; + return r; Property changes on: lang/python36/files/patch-Modules__mathmodule.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow