Repository navigation
test_ioctl fails on macOS #119770
Copy link
Copy link
Closed
Labels
OS-mactestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
./python.exe -m test -v test_ioctl
== CPython 3.14.0a0 (heads/main:a5fef800d3, May 30 2024, 09:48:26) [Clang 15.0.0 (clang-1500.3.9.4)]
== macOS-14.5-arm64-arm-64bit-Mach-O little-endian
== Python build: debug
== cwd: /Users/admin/Projects/cpython/build/test_python_worker_4187æ
== CPU count: 8
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 2309191984
0:00:00 load avg: 63.19 Run 1 test sequentially
0:00:00 load avg: 63.19 [1/1] test_ioctl
test_ioctl (test.test_ioctl.IoctlTests.test_ioctl) ... ok
test_ioctl_mutate (test.test_ioctl.IoctlTests.test_ioctl_mutate) ... ok
test_ioctl_mutate_1024 (test.test_ioctl.IoctlTests.test_ioctl_mutate_1024) ... ok
test_ioctl_mutate_2048 (test.test_ioctl.IoctlTests.test_ioctl_mutate_2048) ... ok
test_ioctl_signed_unsigned_code_param (test.test_ioctl.IoctlTests.test_ioctl_signed_unsigned_code_param) ... ERROR
======================================================================
ERROR: test_ioctl_signed_unsigned_code_param (test.test_ioctl.IoctlTests.test_ioctl_signed_unsigned_code_param)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/admin/Projects/cpython/Lib/test/test_ioctl.py", line 85, in test_ioctl_signed_unsigned_code_param
new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz)
OSError: [Errno 25] Inappropriate ioctl for device
----------------------------------------------------------------------
Ran 5 tests in 0.003s
FAILED (errors=1)
test test_ioctl failed
test_ioctl failed (1 error)
== Tests result: FAILURE ==
1 test failed:
test_ioctl
Total duration: 96 ms
Total tests: run=5
Total test files: run=1/1 failed=1
Result: FAILURECPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-mactestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
Eclips4 commentedon May 30, 2024
Bisected to 92fab33
cc @vstinner
sobolevn commentedon May 30, 2024
Yes, the same happens for me on m2
Eclips4 commentedon May 30, 2024
Unfortunately, this commit breaks backward compatibility. Previously, it was allowed to pass negative values for the
requestparameter and then they were converted to positive values. However, now, due to a change in the type from unsigned int to unsigned long, this is not working.vstinner commentedon May 30, 2024
This test is strange. Why passing negative request if its type is unsigned long? The value should be positive.
test_ioctl was always skipped until recently. I fixed regrtest to test it: #119275
Eclips4 commentedon May 30, 2024
Yes, I agree with you that this is strange. Our documentation does not mention that the
ioctlrequest parameter can be negative. I think this test was broken by design.Eclips4 commentedon May 30, 2024
This line from the
test_ioctl_signed_unsigned_code_paramis confused me:Is there any chance that
TIOCSWINSZcan be negative?vstinner commentedon May 31, 2024
darwin-xnu uses uint32_t with the MSB bit set:
Source:
Python termios module stores the constant as
longintermios_constantsarray, and then create an object using PyLong_FromLong()`.The value may be negative or not depending on how C treats the integers. I would prefer to have a more reliable value.
pythongh-119770: Make termios ioctl() constants positive
pythongh-119770: Make termios ioctl() constants positive
pythongh-119770: Make termios ioctl() constants positive
pythongh-119770: Make termios ioctl() constants positive
pythongh-119770: Make termios ioctl() constants positive
vstinner commentedon May 31, 2024
I wrote PR gh-119840 to make termios ioctl() constants positive and to update test_ioctl.
gh-119770: Make termios ioctl() constants positive (#119840)
pythongh-119770: Make termios ioctl() constants positive (pythonGH-11…
pythongh-119770: Make termios ioctl() constants positive (pythonGH-11…
vstinner commentedon May 31, 2024
Fixed by 64ff1e2
pythongh-119770: Make termios ioctl() constants positive (python#119840)
pythongh-119770: Make termios ioctl() constants positive (python#119840)