This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED usage on Solaris
Type: behavior Stage: needs patch
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, jcea, loewis, neologix, vstinner
Priority: normal Keywords:

Created on 2011-09-17 07:17 by neologix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg144175 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-09-17 07:20
While testing issue #12981, I stumbled on a problem on OpenIndiana buildbot:
"""
test test_multiprocessing crashed -- Traceback (most recent call last):
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/test/regrtest.py", line 1133, in runtest_inner
    the_package = __import__(abstest, globals(), locals(), [])
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/test/test_multiprocessing.py", line 38, in <module>
    from multiprocessing import util, reduction
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 437, in load_module
    return self._load_module(fullname)
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 141, in decorated
    return fxn(self, module, *args, **kwargs)
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 342, in _load_module
    exec(code_object, module.__dict__)
  File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/multiprocessing/reduction.py", line 57, in <module>
    raise ImportError('pickling of connections not supported')
ImportError: pickling of connections not supported
"""

Which means that socket.CMSG_LEN isn't defined.
Now, you might wonder how this can work in the C version of multiprocessing.(sendfd|recvfd), which needs CMSG_LEN().
Here's how:
"""
#ifdef __sun
 /* The control message API is only available on Solaris      
    if XPG 4.2 or later is requested. */      
 #define _XOPEN_SOURCE 500     
 #endif
"""

And indeed:
http://fxr.watson.org/fxr/source/common/sys/socket.h?v=OPENSOLARIS#L478
"""
#if defined(_XPG4_2)
/*
 * The cmsg headers (and macros dealing with them) were made available as
 * part of UNIX95 and hence need to be protected with a _XPG4_2 define.
 */
"""

The problem is that socketmodule uses pyconfig.h defines, and _XOPEN_SOURCE isn't defined on Solaris:
http://hg.python.org/cpython/rev/7c947768b435

(it was added explicitely to Modules/_multiprocessing/multiprocessing.h for sendmsg by http://hg.python.org/cpython/rev/419901e65dd2).
So, _XOPEN_SOURCE is needed on Solaris to build socket_sendmsg and friends.
I'm not sure about the best way to proceed, since Martin certainly had good reasons to remove _XOPEN_SOURCE definition entirely on Solaris.
Should we define it only at the top of socketmodule?
msg144184 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-09-17 13:03
See too http://bugs.python.org/issue6755#msg143798
msg144185 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2011-09-17 13:15
Some rational in issue1759169.
msg144235 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-09-18 09:50
Martin dropped _XOPEN_SOURCE in issue #1759169 (commit 7c947768b435).

--

FYI I changed configure(.in) to get _XOPEN_SOURCE to 700 on OpenBSD 5 to get recent C functions like fdopendir():

  # X/Open 7, incorporating POSIX.1-2008
  AC_DEFINE(_XOPEN_SOURCE, 700,
            Define to the level of X/Open that your system supports)
msg192673 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-08 17:07
I think the cause of the bug has been addressed because tests on Solaris are passing.
msg194167 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-08-02 08:59
OK, let's close then.
We can still re-open if this pops up again.
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57208
2013-08-02 08:59:35neologixsetstatus: pending -> closed

messages: + msg194167
2013-07-08 17:07:31christian.heimessetstatus: open -> pending

nosy: + christian.heimes
messages: + msg192673

resolution: fixed
2011-09-25 10:13:23neologixunlinkissue12981 dependencies
2011-09-18 09:50:45vstinnersetmessages: + msg144235
2011-09-17 13:15:00jceasetmessages: + msg144185
2011-09-17 13:04:58jceasettitle: _XOPEN_SOURCE usage on Solaris -> _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED usage on Solaris
2011-09-17 13:03:50jceasetmessages: + msg144184
2011-09-17 13:01:44jceasetnosy: + jcea
2011-09-17 07:22:45neologixlinkissue12981 dependencies
2011-09-17 07:20:12neologixsetnosy: + loewis
messages: + msg144175
2011-09-17 07:17:25neologixcreate