STINNER Victor <vstin...@python.org> added the comment:
On my FreeBSD 13 VM, the test is skipped: vstinner@freebsd$ ./python -m test -v test_os -m test_get_set_inheritable_o_path == CPython 3.11.0a0 (heads/main:938e84b4fa, Aug 6 2021, 10:46:32) [Clang 11.0.1 (g...@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3 == FreeBSD-13.0-RELEASE-amd64-64bit-ELF little-endian (...) test_get_set_inheritable_o_path (test.test_os.FDInheritanceTests) ... skipped 'need os.O_PATH' It seems like O_PATH was introduced in FreeBSD 14 CURRENT, but the test fails. Code of the test: @unittest.skipUnless(hasattr(os, 'O_PATH'), "need os.O_PATH") def test_get_set_inheritable_o_path(self): fd = os.open(__file__, os.O_PATH) self.addCleanup(os.close, fd) self.assertEqual(os.get_inheritable(fd), False) os.set_inheritable(fd, True) # <==== OSError: [Errno 9] Bad file descriptor self.assertEqual(os.get_inheritable(fd), True) os.set_inheritable(fd, False) self.assertEqual(os.get_inheritable(fd), False) os.set_inheritable() calls _Py_set_inheritable() whichs has multiple implementations: * ioctl(fd, FIONCLEX, NULL) * fcntl(fd, F_GETFD) + fcntl(fd, F_SETFD, new_flags) Linux has a special code path: #ifdef __linux__ if (errno == EBADF) { // On Linux, ioctl(FIOCLEX) will fail with EBADF for O_PATH file descriptors // Fall through to the fcntl() path } else #endif Maybe we should just enable now this code path on FreeBSD as well. == test.pythoninto of the last successful build 654 == datetime.datetime.now: 2021-08-01 01:15:06.918625 os.uname: posix.uname_result(sysname='FreeBSD', nodename='140-CURRENT-amd64-564d', release='14.0-CURRENT', version='FreeBSD 14.0-CURRENT #14 main-n245176-8742817ba62: Tue Mar 2 03:48:10 UTC 2021 root@140-CURRENT-amd64:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG', machine='amd64') == test.pythoninto of the failed build 655 == datetime.datetime.now: 2021-08-04 09:56:34.287999 os.uname: posix.uname_result(sysname='FreeBSD', nodename='140-CURRENT-amd64-564d', release='14.0-CURRENT', version='FreeBSD 14.0-CURRENT #0 main-n248401-de0c7fbe280: Mon Aug 2 02:42:31 UTC 2021 root@140-CURRENT-amd64-564d:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG', machine='amd64') ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44849> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com