classification
Title: macOS: posix_spawn(..., setsid=True)
Type: behavior Stage: needs patch
Components: macOS Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: ned.deily, ronaldoussoren, serhiy.storchaka, steve.dower
Priority: low Keywords:

Created on 2019-07-13 13:27 by ronaldoussoren, last changed 2020-07-31 11:12 by ned.deily.

Messages (7)
msg347816 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-07-13 13:27
The Xcode 11 beta introduced a definition for POSIX_SPAWN_SETSID, but that flag is only supported on macOS 10.15 (also beta), not on earlier versions.

Because of this the testsuite will have failures when you build using Xcode 11 on macOS 10.14. 

I'm not sure what the best way to patch this is, but lean toward a fix that detects the use of setsid=True on macOS 10.14 or earlier and then fails. Possibly as part of a larger effort to start supporting building on macOS "latest" and running on older versions.

Marked as low priority for now, Xcode 11 is in beta and not used to build release binaries.
msg347817 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-07-13 13:31
File a bug in Xcode 11?

If it will not be fixed we will need to add a workaround (like checking the macOS version explicitly).
msg347819 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-07-13 13:50
This is not a bug in Xcode 11. Xcode 11 includes definitions for new flags that get picked up by Python's build, but only work on a new version of macOS. 

I guess this could be seen as a bug in macOS 10.14 (and earlier) because it ignores an unknown flag instead of returning an error.  Knowing Apple that's unlikely to get fixed, if it even is a bug (<http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getflags.html> says that returning EINVAL is optional for an invalid value of "flags").
msg374585 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-07-29 19:39
I just started running into a failure that looks like this on some private builds (Xcode_11.3.1 on macOS-10.14.6-x86_64-i386-64bit):

======================================================================
FAIL: test_setsid (test.test_posix.TestPosixSpawnP)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/1/s/Lib/test/test_posix.py", line 1692, in test_setsid
    self.assertNotEqual(parent_sid, child_sid)
AssertionError: 1 == 1

Is that this issue? Or something else?
msg374603 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-07-30 07:33
That's this issue.

FWIW: I'm slowly working on a patch to build on macOS 11 and deploy to macOS 10.9 or later, the current rough and untested PR is at https://github.com/python/cpython/pull/21583. 

This needs testing and cleanup before it can be considered for merging.
msg374623 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-07-30 20:32
Oh great, it's one of these style changes :)

You probably want to define some macros for those barriers so the added optional nesting doesn't come back to bite us later.

Otherwise, best of luck! Let me know if I can help out (for now I'm just ignoring the setsid test).
msg374636 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-07-31 11:12
The immediate problem is that the version of Xcode you are using supplies a MacOSX10.15 SDK by default. Since you are running on 10.14, the test passes if you build using a MacOSX10.14 SDK. Either upgrade to 10.15 or grab the 10.14 SDK from a previous version of Xcode or the Command Line Tools (which is all you need to build and test Python) and make that SDK the default.  Ronald's patch will eventually fix that but, unless you are building for a newer OS version on an older OS version, it is still safest to use the SDK version that corresponds to the running system.
History
Date User Action Args
2020-07-31 11:12:47ned.deilysetmessages: + msg374636
2020-07-30 20:32:14steve.dowersetmessages: + msg374623
versions: + Python 3.10
2020-07-30 07:33:09ronaldoussorensetmessages: + msg374603
2020-07-29 19:39:12steve.dowersetnosy: + steve.dower
messages: + msg374585
2019-07-13 13:50:35ronaldoussorensetmessages: + msg347819
2019-07-13 13:31:31serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg347817
2019-07-13 13:27:37ronaldoussorencreate