From owner-freebsd-python@FreeBSD.ORG Sun Jan 22 19:38:56 2012 Return-Path: Delivered-To: python@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C1E31065675; Sun, 22 Jan 2012 19:38:56 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id C0F018FC1D; Sun, 22 Jan 2012 19:38:55 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id q0MJPQW5033285; Sun, 22 Jan 2012 14:25:26 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id q0MJPQiK033276; Sun, 22 Jan 2012 14:25:26 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Sun, 22 Jan 2012 14:25:26 -0500 From: David Schultz To: Andriy Gapon Message-ID: <20120122192526.GA52071@zim.MIT.EDU> Mail-Followup-To: Andriy Gapon , python@freebsd.org, freebsd-standards@freebsd.org, gogo@cs.uni-sb.de, theraven@freebsd.org References: <4F1AAA75.5050500@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F1AAA75.5050500@FreeBSD.org> Cc: theraven@FreeBSD.ORG, freebsd-standards@FreeBSD.ORG, python@FreeBSD.ORG, gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 19:38:56 -0000 On Sat, Jan 21, 2012, Andriy Gapon wrote: > > 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. > > But in FreeBSD 10 we now have interfaces from POSIX 200809, specifically some > things that are then used by xlocale.h. > > 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 >= 200809. And because of pyconfig.h, > py-lxml build doesn't see locale_t and so the build fails. > > This is probably an issue that the upstream should also consider. > > Having briefly looked at python27's configure script I wonder if we should set > define_xopen_source=no for FreeBSD 10 (like it has been done for FreeBSD/4.*). > > 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). > > Thoughts, ideas, suggestions? > Thank you! 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. From owner-freebsd-python@FreeBSD.ORG Mon Jan 23 11:07:11 2012 Return-Path: Delivered-To: freebsd-python@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 909821065676 for ; Mon, 23 Jan 2012 11:07:11 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 63EE88FC1D for ; Mon, 23 Jan 2012 11:07:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0NB7Biu081054 for ; Mon, 23 Jan 2012 11:07:11 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0NB7AK6081052 for freebsd-python@FreeBSD.org; Mon, 23 Jan 2012 11:07:10 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 23 Jan 2012 11:07:10 GMT Message-Id: <201201231107.q0NB7AK6081052@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-python@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-python@FreeBSD.org X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 11:07:11 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o ports/163112 python Updates bsd.python.mk to support Zope 2.11, 2.13 o ports/163063 python [PATCH] fix for ports-mgmt/portbuilder o ports/162421 python lang/python32 fails to build (undefined reference to ` o ports/160717 python port: lang/python27 causing other ports to hang during o ports/159215 python Mk/bsd.python.mk: PYTHON_VERSION is ignored o ports/156759 python [patch] lang/python: kevent does not accept KQ_NOTE_EX o ports/156425 python lang/python26: Needs to include -L/usr/local/lib/pth i o ports/156076 python [patch] databases/py-sqlite3: Undefined symbol "sqlite o ports/155970 python [PATCH] lang/python: speed up upgrade-site-packages o ports/155936 python lang/python27 Pthread: previous declaration of ... o ports/155526 python [PATCH] devel/py-elementtree: ignore if python >= 2.5 f ports/154209 python [PATCH] lang/python: Install symlink for ptags o ports/153952 python lang/python26 + pth fails to reconfigure cflags to inc o ports/153167 python Problem with signals, threads, and subprocesses in lan o ports/152224 python [patch] fix installed permissions for lang/python27 o ports/151534 python lang/python26 + WITH_PTH doesn't install correctly o ports/149167 python lang/python26 fails to build _ctypes on Sheevaplug (AR o ports/146957 python Mk/bsd.python.mk: PYTHONOPTIMIZE=1 in environ(7) break o ports/146823 python [patch] lang/python26: knob to build _ctypes module ag o ports/146644 python lang/python26: WITH_PTH option breaks most ports depen o ports/140968 python x11-toolkits/py-tkinter(devel/pth): py26-tkinter-2.6.4 o ports/136917 python [patch] lang/python26: gettext detection o ports/133081 python [bsd.python.mk] PYEASYINSTALL_ARCHDEP=yes makes broken 23 problems total. From owner-freebsd-python@FreeBSD.ORG Wed Jan 25 13:50:55 2012 Return-Path: Delivered-To: python@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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues 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= From owner-freebsd-python@FreeBSD.ORG Wed Jan 25 17:55:03 2012 Return-Path: Delivered-To: freebsd-python@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B06C0106564A for ; Wed, 25 Jan 2012 17:55:03 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0EE218FC13 for ; Wed, 25 Jan 2012 17:55:02 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id q0PHsjol048045; Wed, 25 Jan 2012 18:55:01 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id q0PHsj0u048044; Wed, 25 Jan 2012 18:54:45 +0100 (CET) (envelope-from olli) Date: Wed, 25 Jan 2012 18:54:45 +0100 (CET) Message-Id: <201201251754.q0PHsj0u048044@lurza.secnetix.de> From: Oliver Fromme To: freebsd-python@FreeBSD.ORG X-Newsgroups: list.freebsd-python User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (lurza.secnetix.de [127.0.0.1]); Wed, 25 Jan 2012 18:55:01 +0100 (CET) Cc: Subject: Installing multiple Python versions + tkinter X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 17:55:03 -0000 Hi, I would like to install Python 2.7 in addition to an existing installation of Python 2.6. The latter should stay the default version. These are the existing Python ports: python26 py26-tkinter Now I've installed python27, too. That works fine so far, but I would also like to install tkinter for Python 2.7 (because I want to use ttk). Unfortunately that doesn't seem to be possible. The port only builds for 2.6, and there is no option or other setting, as far as I can see. What's the proper way to build tkinter for a non-default Python version? Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind." -- Alan Kay, OOPSLA '97 From owner-freebsd-python@FreeBSD.ORG Wed Jan 25 18:27:30 2012 Return-Path: Delivered-To: freebsd-python@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B3E6106564A for ; Wed, 25 Jan 2012 18:27:30 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 60C2F8FC15 for ; Wed, 25 Jan 2012 18:27:29 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id q0PIRCLX049738; Wed, 25 Jan 2012 19:27:27 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id q0PIRCpY049737; Wed, 25 Jan 2012 19:27:12 +0100 (CET) (envelope-from olli) Date: Wed, 25 Jan 2012 19:27:12 +0100 (CET) Message-Id: <201201251827.q0PIRCpY049737@lurza.secnetix.de> From: Oliver Fromme To: freebsd-python@FreeBSD.ORG In-Reply-To: <201201251754.q0PHsj0u048044@lurza.secnetix.de> X-Newsgroups: list.freebsd-python User-Agent: tin/1.9.6-20101126 ("Burnside") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (lurza.secnetix.de [127.0.0.1]); Wed, 25 Jan 2012 19:27:27 +0100 (CET) Cc: Subject: Re: Installing multiple Python versions + tkinter X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 18:27:30 -0000 Oliver Fromme wrote: > What's the proper way to build tkinter for a non-default > Python version? Answering myself ... By reading through the bsd.python.mk Makefile I found out that the following incantation in tkinter's port directory does the trick: # PYTHON_DEFAULT_VERSION=python2.7 make However, I think this should be documented somewhere in a reasonable place. It certainly shouldn't require users to read Makefiles. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I have stopped reading Stephen King novels. Now I just read C code instead." -- Richard A. O'Keefe From owner-freebsd-python@FreeBSD.ORG Wed Jan 25 20:51:45 2012 Return-Path: Delivered-To: python@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E58B10656D1; Wed, 25 Jan 2012 20:51:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D7D238FC17; Wed, 25 Jan 2012 20:51:43 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA14100; Wed, 25 Jan 2012 22:51:42 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Rq9oj-0006tc-UV; Wed, 25 Jan 2012 22:51:41 +0200 Message-ID: <4F206B5D.3080302@FreeBSD.org> Date: Wed, 25 Jan 2012 22:51:41 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: David Chisnall References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> In-Reply-To: <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: David Schultz , freebsd-standards@FreeBSD.org, python@FreeBSD.org, gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 20:51:45 -0000 on 25/01/2012 15:23 David Chisnall said the following: > On 22 Jan 2012, at 19:25, David Schultz wrote: >> 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. Thank you for the insights. > 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? I think that this should work. -- Andriy Gapon From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 05:15:40 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 506BC1065677; Thu, 26 Jan 2012 05:15:40 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 635E48FC0C; Thu, 26 Jan 2012 05:15:38 +0000 (UTC) Received: by lahj13 with SMTP id j13so143899lah.13 for ; Wed, 25 Jan 2012 21:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=c/3A3fGkzLCoJFC8ZPh3Ww2JU6l2K3iL/xKY/0QnBg0=; b=qsgP4mAWdMz9T6bnMEhgGP1DgfC0l8jNqogLOHW7K5BiFKzCCsnbJA2dGxaiYoyOJ4 RzbJwo+23abo1I+gXD7PMD6Yd/BG1G2fylT11FVckQpLxlPp762wLcitoL8J0E2gfp22 ldd216pqn9Ga3It5AQYF2UY92xhZ6yZwIA5Zs= Received: by 10.112.48.65 with SMTP id j1mr115128lbn.76.1327553291231; Wed, 25 Jan 2012 20:48:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.25.196 with HTTP; Wed, 25 Jan 2012 20:47:41 -0800 (PST) In-Reply-To: <4F206B5D.3080302@FreeBSD.org> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> From: Eitan Adler Date: Wed, 25 Jan 2012 23:47:41 -0500 Message-ID: To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-standards@freebsd.org, David Schultz , David Chisnall , python@freebsd.org, gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 05:15:40 -0000 On Wed, Jan 25, 2012 at 3:51 PM, Andriy Gapon wrote: > on 25/01/2012 15:23 David Chisnall said the following: >> On 22 Jan 2012, at 19:25, David Schultz wrote: >>> Technically it's a problem with python. =C2=A0If 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 opposit= e way to everyone else (glibc thinks defining these macros means expose fun= ctionality from this standard, don't expose it otherwise, everyone else thi= nks they mean expose only the things defined by this standard). =C2=A0This = 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. > > Thank you for the insights. > >> 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? > > I think that this should work. What about patching python to only define the POSIX macros iff glibc is being used (and getting this upstreamed) ? --=20 Eitan Adler From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 11:34:06 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9076E1065672; Thu, 26 Jan 2012 11:34:06 +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 1A45D8FC14; Thu, 26 Jan 2012 11:34:05 +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 q0QBXvcv058372 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 26 Jan 2012 11:33:57 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: Date: Thu, 26 Jan 2012 11:34:00 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> To: Eitan Adler X-Mailer: Apple Mail (2.1251.1) Cc: David Schultz , 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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 11:34:06 -0000 On 26 Jan 2012, at 04:47, Eitan Adler wrote: > On Wed, Jan 25, 2012 at 3:51 PM, Andriy Gapon wrote: >> on 25/01/2012 15:23 David Chisnall said the following: >>> On 22 Jan 2012, at 19:25, David Schultz wrote: >>>> 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. >>>=20 >>> 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 >> Thank you for the insights. >>=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 >> I think that this should work. >=20 > What about patching python to only define the POSIX macros iff glibc > is being used (and getting this upstreamed) ? That would be ideal, but I'd prefer that we did anything that we can = within the standard to ensure that people who do silly thing that work = on other platforms don't end up saying 'FreeBSD sucks!' because of their = code. Please can you someone verify that this patch fixes the problem? =20= David Index: include/locale.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/locale.h (revision 230510) +++ include/locale.h (working copy) @@ -79,7 +79,8 @@ char *setlocale(int, const char *); __END_DECLS =20 -#if __POSIX_VISIBLE >=3D 200809 +#if __POSIX_VISIBLE >=3D 200809 && !defined(__X_LOCALE_DEFINED) +#define __X_LOCALE_DEFINED =20 #define LC_COLLATE_MASK (1<<0) #define LC_CTYPE_MASK (1<<1) Index: include/xlocale.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/xlocale.h (revision 230510) +++ include/xlocale.h (working copy) @@ -35,7 +35,33 @@ #include =20 __BEGIN_DECLS +/* + * If people turned off POSIX2008 stuff, but still explicitly included = the + * xlocale.h header, then assume that they actually do want these = functions and + * define them. + */ +#ifndef __X_LOCALE_DEFINED +#define __X_LOCALE_DEFINED =20 +#define LC_COLLATE_MASK (1<<0) +#define LC_CTYPE_MASK (1<<1) +#define LC_MESSAGES_MASK (1<<2) +#define LC_MONETARY_MASK (1<<3) +#define LC_NUMERIC_MASK (1<<4) +#define LC_TIME_MASK (1<<5) +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | = LC_MESSAGES_MASK | \ + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) +#define LC_GLOBAL_LOCALE ((locale_t)-1) + +typedef struct _xlocale *locale_t; +locale_t newlocale(int mask, const char *locale, locale_t base); +locale_t duplocale(locale_t base); +int freelocale(locale_t loc); +const char *querylocale(int mask, locale_t loc); +locale_t uselocale(locale_t loc); + +#endif /* __X_LOCALE_DEFINED */ + /* * Extended locale versions of the locale-aware functions from = string.h. * From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 12:42:37 2012 Return-Path: Delivered-To: python@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E59106567B; Thu, 26 Jan 2012 12:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2B4BB8FC21; Thu, 26 Jan 2012 12:42:35 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id OAA27737; Thu, 26 Jan 2012 14:42:33 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <4F214A39.6050403@FreeBSD.org> Date: Thu, 26 Jan 2012 14:42:33 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120111 Thunderbird/9.0 MIME-Version: 1.0 To: Eitan Adler References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-standards@FreeBSD.org, David Schultz , David Chisnall , python@FreeBSD.org, gogo@cs.uni-sb.de Subject: Re: pyconfig.h and freebsd10: _POSIX_C_SOURCE and _XOPEN_SOURCE X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 12:42:37 -0000 on 26/01/2012 06:47 Eitan Adler said the following: > On Wed, Jan 25, 2012 at 3:51 PM, Andriy Gapon wrote: >> on 25/01/2012 15:23 David Chisnall said the following: >>> On 22 Jan 2012, at 19:25, David Schultz wrote: >>>> 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. >> >> Thank you for the insights. >> >>> 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? >> >> I think that this should work. > > What about patching python to only define the POSIX macros iff glibc > is being used (and getting this upstreamed) ? IMO, this should work too. At least for us :-) -- Andriy Gapon From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 14:00:31 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C4131065673; Thu, 26 Jan 2012 14:00:31 +0000 (UTC) (envelope-from das@freebsd.org) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id B2BBF8FC0A; Thu, 26 Jan 2012 14:00:30 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id q0QE0LN6018208; Thu, 26 Jan 2012 09:00:21 -0500 (EST) (envelope-from das@freebsd.org) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id q0QE0LPs018207; Thu, 26 Jan 2012 09:00:21 -0500 (EST) (envelope-from das@freebsd.org) Date: Thu, 26 Jan 2012 09:00:21 -0500 From: David Schultz To: David Chisnall Message-ID: <20120126140021.GA18060@zim.MIT.EDU> Mail-Followup-To: David Chisnall , Eitan Adler , Andriy Gapon , freebsd-standards@freebsd.org, python@freebsd.org, gogo@cs.uni-sb.de References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> Cc: Eitan Adler , 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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 14:00:31 -0000 On Thu, Jan 26, 2012, David Chisnall wrote: > > On 26 Jan 2012, at 04:47, Eitan Adler wrote: > > What about patching python to only define the POSIX macros iff glibc > > is being used (and getting this upstreamed) ? That's a good strategy regardless. As long as python is doing something bogus, it could easily break in the future. > Index: include/xlocale.h [...] > +/* > + * If people turned off POSIX2008 stuff, but still explicitly included the > + * xlocale.h header, then assume that they actually do want these functions and > + * define them. > + */ > +#ifndef __X_LOCALE_DEFINED > +#define __X_LOCALE_DEFINED > > +#define LC_COLLATE_MASK (1<<0) > +#define LC_CTYPE_MASK (1<<1) > +#define LC_MESSAGES_MASK (1<<2) > +#define LC_MONETARY_MASK (1<<3) > +#define LC_NUMERIC_MASK (1<<4) > +#define LC_TIME_MASK (1<<5) > +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ > + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) > +#define LC_GLOBAL_LOCALE ((locale_t)-1) > + > +typedef struct _xlocale *locale_t; > +locale_t newlocale(int mask, const char *locale, locale_t base); > +locale_t duplocale(locale_t base); > +int freelocale(locale_t loc); > +const char *querylocale(int mask, locale_t loc); > +locale_t uselocale(locale_t loc); > + > +#endif /* __X_LOCALE_DEFINED */ It would be preferable not to have two copies of all the definitions and declarations in the source. This is often handled with separate headers like sys/_timeval.h and sys/_types.h. Perhaps that's too many hoops to jump through just to cope with buggy applications. (Incidentally, I noticed that the LC_* macros are in a slightly different order from the LC_*_MASK macros. For that reason, and only that reason, it's not possible to define the latter in terms of the former.) Would it suffice, perhaps, to simply change the xlocale declarations to use type `struct _xlocale' instead of locale_t? That won't fix apps that expect the LC_*_MASK macros to be defined, but it looks like it will at least make the header compile in a strict POSIX environment, and it avoids the duplication. By the way, struct _xlocale needs another underscore in front of it. Names prefixed with a single underscore and a lowercase letter are in the application's namespace. From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 16:56:17 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B931106564A; Thu, 26 Jan 2012 16:56:17 +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 E48668FC0C; Thu, 26 Jan 2012 16:56:16 +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 q0QGu72J060492 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 26 Jan 2012 16:56:08 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: <20120126140021.GA18060@zim.MIT.EDU> Date: Thu, 26 Jan 2012 16:56:02 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <4BC83792-2FE3-4B7A-8CB1-18B4FF82A8CD@freebsd.org> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> <20120126140021.GA18060@zim.MIT.EDU> To: David Schultz X-Mailer: Apple Mail (2.1251.1) Cc: Eitan Adler , 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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 16:56:17 -0000 On 26 Jan 2012, at 14:00, David Schultz wrote: > On Thu, Jan 26, 2012, David Chisnall wrote: >>=20 >> On 26 Jan 2012, at 04:47, Eitan Adler wrote: >>> What about patching python to only define the POSIX macros iff glibc >>> is being used (and getting this upstreamed) ? >=20 > That's a good strategy regardless. As long as python is doing > something bogus, it could easily break in the future. >=20 >> Index: include/xlocale.h > [...] >> +/* >> + * If people turned off POSIX2008 stuff, but still explicitly = included the >> + * xlocale.h header, then assume that they actually do want these = functions and >> + * define them. >> + */ >> +#ifndef __X_LOCALE_DEFINED >> +#define __X_LOCALE_DEFINED >>=20 >> +#define LC_COLLATE_MASK (1<<0) >> +#define LC_CTYPE_MASK (1<<1) >> +#define LC_MESSAGES_MASK (1<<2) >> +#define LC_MONETARY_MASK (1<<3) >> +#define LC_NUMERIC_MASK (1<<4) >> +#define LC_TIME_MASK (1<<5) >> +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | = LC_MESSAGES_MASK | \ >> + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) >> +#define LC_GLOBAL_LOCALE ((locale_t)-1) >> + >> +typedef struct _xlocale *locale_t; >> +locale_t newlocale(int mask, const char *locale, locale_t base); >> +locale_t duplocale(locale_t base); >> +int freelocale(locale_t loc); >> +const char *querylocale(int mask, locale_t loc); >> +locale_t uselocale(locale_t loc); >> + >> +#endif /* __X_LOCALE_DEFINED */ >=20 > It would be preferable not to have two copies of all the > definitions and declarations in the source. This is often handled > with separate headers like sys/_timeval.h and sys/_types.h. > Perhaps that's too many hoops to jump through just to cope with > buggy applications. (Incidentally, I noticed that the LC_* macros > are in a slightly different order from the LC_*_MASK macros. For > that reason, and only that reason, it's not possible to define the > latter in terms of the former.) >=20 > Would it suffice, perhaps, to simply change the xlocale > declarations to use type `struct _xlocale' instead of locale_t? > That won't fix apps that expect the LC_*_MASK macros to be > defined, but it looks like it will at least make the header > compile in a strict POSIX environment, and it avoids the=20 > duplication. Yup, that would probably be fine. > By the way, struct _xlocale needs another underscore in front of > it. Names prefixed with a single underscore and a lowercase > letter are in the application's namespace. It is struct _xlocale on Darwin, where this API was introduced as an = extension before making it into POSIX, so I kept the name in case anyone = depends on this. David= From owner-freebsd-python@FreeBSD.ORG Thu Jan 26 16:59:17 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D54C8106568B; Thu, 26 Jan 2012 16:59:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id 669788FC18; Thu, 26 Jan 2012 16:59:16 +0000 (UTC) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0QEx0pn004440; Fri, 27 Jan 2012 01:59:02 +1100 Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q0QEwdoj025929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Jan 2012 01:58:40 +1100 Date: Fri, 27 Jan 2012 01:58:39 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Schultz In-Reply-To: <20120126140021.GA18060@zim.MIT.EDU> Message-ID: <20120127012410.A1336@besplex.bde.org> References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> <9F9CC3ED-0686-4BC5-BF01-1839A30ABA9C@FreeBSD.ORG> <4F206B5D.3080302@FreeBSD.org> <3B3BEEED-D1E4-4329-BE34-5CFF5CABB52C@freebsd.org> <20120126140021.GA18060@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-standards@freebsd.org, David Chisnall , 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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 16:59:18 -0000 On Thu, 26 Jan 2012, David Schultz wrote: > On Thu, Jan 26, 2012, David Chisnall wrote: >> >> On 26 Jan 2012, at 04:47, Eitan Adler wrote: >>> What about patching python to only define the POSIX macros iff glibc >>> is being used (and getting this upstreamed) ? > > That's a good strategy regardless. As long as python is doing > something bogus, it could easily break in the future. > >> Index: include/xlocale.h > [...] >> +/* >> + * If people turned off POSIX2008 stuff, but still explicitly included the >> + * xlocale.h header, then assume that they actually do want these functions and >> + * define them. >> + */ >> +#ifndef __X_LOCALE_DEFINED >> +#define __X_LOCALE_DEFINED >> >> +#define LC_COLLATE_MASK (1<<0) >> +#define LC_CTYPE_MASK (1<<1) >> +#define LC_MESSAGES_MASK (1<<2) >> +#define LC_MONETARY_MASK (1<<3) >> +#define LC_NUMERIC_MASK (1<<4) >> +#define LC_TIME_MASK (1<<5) >> +#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ >> + LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) >> +#define LC_GLOBAL_LOCALE ((locale_t)-1) >> + >> +typedef struct _xlocale *locale_t; >> +locale_t newlocale(int mask, const char *locale, locale_t base); >> +locale_t duplocale(locale_t base); >> +int freelocale(locale_t loc); >> +const char *querylocale(int mask, locale_t loc); >> +locale_t uselocale(locale_t loc); This file has mounds of style bugs. This change adds many more: - all tabs after #define are corrupt - all spaces around the binary operator `<<' are missing. - the prototype for newlocale() is disordered. The prototypes have mounds of namespace pollution. All their parameters have names in the application namespace. locale.h used to have only 1 corrupt tab after #define (the one, but now has the above. It also has verbose comments on the prototypes which make the actual prototypes hard to read. Normally, prototypes have no comment, as for old prototypes in locale.h. Some of the comments are not formatted normally. >> + >> +#endif /* __X_LOCALE_DEFINED */ > > It would be preferable not to have two copies of all the > definitions and declarations in the source. This is often handled > with separate headers like sys/_timeval.h and sys/_types.h. > Perhaps that's too many hoops to jump through just to cope with > buggy applications. (Incidentally, I noticed that the LC_* macros > are in a slightly different order from the LC_*_MASK macros. For > that reason, and only that reason, it's not possible to define the > latter in terms of the former.) > > Would it suffice, perhaps, to simply change the xlocale > declarations to use type `struct _xlocale' instead of locale_t? > That won't fix apps that expect the LC_*_MASK macros to be > defined, but it looks like it will at least make the header > compile in a strict POSIX environment, and it avoids the > duplication. > > By the way, struct _xlocale needs another underscore in front of > it. Names prefixed with a single underscore and a lowercase > letter are in the application's namespace. No, this is not one of the many missing underscores in the above. Identifiers that begin with a single underscore which is followed by any character that gives a valid identifier (an upper or lower case letter, or a digit) are reserved for use as identifiers with file scope in both the ordinary and tag name spaces. The above only uses _xlocale in file scope (in a typedef), so application use of it can't clobber this use. Only use of it in macros is likely to require 2 underscores, but there is no such use. Using it for only a tag name limits problems with underscores even more than usual. Bruce From owner-freebsd-python@FreeBSD.ORG Fri Jan 27 16:09:58 2012 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE75A106566C; Fri, 27 Jan 2012 16:09:58 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay006.isp.belgacom.be (mailrelay006.isp.belgacom.be [195.238.6.172]) by mx1.freebsd.org (Postfix) with ESMTP id 95F168FC0C; Fri, 27 Jan 2012 16:09:57 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAO/IIk9bsYWl/2dsb2JhbABErB+CMYEGgXIBAQVWIxALGC45HogXuCWJEAElBgkBCAEGBAMDBAwZgmyBNQUhAQIggxwEiAyWOYkj Received: from 165.133-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.133.165]) by relay.skynet.be with ESMTP; 27 Jan 2012 16:59:49 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q0RFxmga003618; Fri, 27 Jan 2012 16:59:48 +0100 (CET) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: freebsd-standards@freebsd.org Date: Fri, 27 Jan 2012 16:59:40 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <4F1AAA75.5050500@FreeBSD.org> <20120122192526.GA52071@zim.MIT.EDU> In-Reply-To: <20120122192526.GA52071@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1395942.TgWN4u9Efg"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201201271659.45930.tijl@coosemans.org> Cc: David Schultz , theraven@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-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2012 16:09:59 -0000 --nextPart1395942.TgWN4u9Efg Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Sunday 22 January 2012 20:25:26 David Schultz wrote: > On Sat, Jan 21, 2012, Andriy Gapon wrote: >> 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 pyt= hon >> (obviously). libxslt doesn't have any limitations in POSIX interfaces t= hat it >> uses, so it detects xlocale.h and uses it. xlocale.h depends on definit= ion of >> locale_t in locale.h. But since locale_t has been introduced in POSIX 2= 008 its >> declaration is under __POSIX_VISIBLE >=3D 200809. And because of pyconf= ig.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 shou= ld set >> define_xopen_source=3Dno for FreeBSD 10 (like it has been done for FreeB= SD/4.*). >>=20 >> But in general I am not sure why python has to limit itself to those lev= els 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 POSIX feature macros only mean that headers that are part of the standard need to behave as defined by the standard. Non-standard headers like xlocale.h can do whatever they want. So if that header wants to expose a new locale API it can do so, but then it must also expose locale_t of course, because you cannot use the API without it. However, xlocale.h is a very ugly header (does different things depending on which headers have been included already), and some of the function prototypes have become part of the latest POSIX standard and need to be moved to different headers (strxfrm_l, strcoll_l,...). So it may be better to move all prototypes to their respective headers and remove xlocale.h (or leave a minimal header like glibc seems to have done). Then libxslt would have to be patched to support plain POSIX and not require xlocale.h. --nextPart1395942.TgWN4u9Efg Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk8iyfEACgkQfoCS2CCgtivNfwD/SQkWxgm2V9qcsXIBAOa0M2mT uydibAy1gl2NJ3pwBR4A/3IMuWBTkF9lac5SUuydEEICUzS/IA3iDV6UK2vwV9dZ =pFYg -----END PGP SIGNATURE----- --nextPart1395942.TgWN4u9Efg-- From owner-freebsd-python@FreeBSD.ORG Sat Jan 28 16:44:22 2012 Return-Path: Delivered-To: freebsd-python@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EC69106566B for ; Sat, 28 Jan 2012 16:44:22 +0000 (UTC) (envelope-from phoffman@proper.com) Received: from hoffman.proper.com (IPv6.Hoffman.Proper.COM [IPv6:2605:8e00:100:41::81]) by mx1.freebsd.org (Postfix) with ESMTP id CEFF88FC0A for ; Sat, 28 Jan 2012 16:44:21 +0000 (UTC) Received: from [10.20.30.103] (50-0-66-4.dsl.dynamic.fusionbroadband.com [50.0.66.4]) (authenticated bits=0) by hoffman.proper.com (8.14.5/8.14.3) with ESMTP id q0SGiKXC007466 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Sat, 28 Jan 2012 09:44:21 -0700 (MST) (envelope-from phoffman@proper.com) From: Paul Hoffman Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Jan 2012 08:44:22 -0800 Message-Id: <55B0BE3D-F416-4FE1-81FB-5933D9A3307B@proper.com> To: freebsd-python@FreeBSD.org Mime-Version: 1.0 (Apple Message framework v1251.1) X-Mailer: Apple Mail (2.1251.1) Cc: Subject: py-sqlite3 missing in packages, needed for Python >2.6 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 16:44:22 -0000 Greetings again. I opened a thread in the forums: = that is relevant = here. In short: In the packages system, there is = py26-sqlite3-2.6.6_1.tbz, which only applies to Python 2.6. Many (most?) = of us are running Python 2.7 or 3.x. I need a package (not port) version = for Python 3.1, which I also installed from packages. Any clues would be appreciated.