From owner-freebsd-standards@FreeBSD.ORG Wed Jan 25 13:50:55 2012 Return-Path: Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEDCB106567F; Wed, 25 Jan 2012 13:50:55 +0000 (UTC) (envelope-from theraven@FreeBSD.ORG) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id 7B0888FC12; Wed, 25 Jan 2012 13:50:55 +0000 (UTC) Received: from [192.168.0.2] (cpc1-cwma8-2-0-cust257.7-3.cable.virginmedia.com [82.20.153.2]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id q0PDNLo5048622 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Wed, 25 Jan 2012 13:23:22 GMT (envelope-from theraven@FreeBSD.ORG) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20120122192526.GA52071@zim.MIT.EDU> Date: Wed, 25 Jan 2012 13:23:22 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> To: David Schultz X-Mailer: Apple Mail (2.1251.1) Cc: freebsd-standards@FreeBSD.ORG, python@FreeBSD.ORG, Andriy Gapon , gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 13:50:56 -0000 On 22 Jan 2012, at 19:25, David Schultz wrote: > On Sat, Jan 21, 2012, Andriy Gapon wrote: >>=20 >> It seems that python27's pyconfig.h (artificially?) limits visibility = of system >> APIs by setting _POSIX_C_SOURCE to 200112L and _XOPEN_SOURCE to 600. >> This might not actually change much for earlier FreeBSD versions. >>=20 >> But in FreeBSD 10 we now have interfaces from POSIX 200809, = specifically some >> things that are then used by xlocale.h. >>=20 >> Now take an example of py-lxml port. It depends on both libxslt and = python >> (obviously). libxslt doesn't have any limitations in POSIX = interfaces that it >> uses, so it detects xlocale.h and uses it. xlocale.h depends on = definition of >> locale_t in locale.h. But since locale_t has been introduced in = POSIX 2008 its >> declaration is under __POSIX_VISIBLE >=3D 200809. And because of = pyconfig.h, >> py-lxml build doesn't see locale_t and so the build fails. >>=20 >> This is probably an issue that the upstream should also consider. >>=20 >> Having briefly looked at python27's configure script I wonder if we = should set >> define_xopen_source=3Dno for FreeBSD 10 (like it has been done for = FreeBSD/4.*). >>=20 >> But in general I am not sure why python has to limit itself to those = levels of >> interfaces (_POSIX_C_SOURCE 200112L and _XOPEN_SOURCE 600). >>=20 >> Thoughts, ideas, suggestions? >> Thank you! >=20 > Technically it's a problem with python. If you ask for a strict > POSIX environment (doesn't matter what version) and also #include > a non-POSIX header, there's no guarantee about what you'll get. > I've CC'd the xlocale author in case he wants to comment or > voluntarily make xlocale work in an otherwise strict POSIX > environment, but that's not officially supported. The problem is really with glibc, which uses these macros in the = opposite way to everyone else (glibc thinks defining these macros means = expose functionality from this standard, don't expose it otherwise, = everyone else thinks they mean expose only the things defined by this = standard). This makes writing portable code a pain and, while I'd = usually be keen to blame Python for everything, in this case I = sympathise with their problem. =20 Would defining locale_t and the related functions in xlocale.h if we are = in a mode where they are not normally exposed fix the problem? =20 David=