Skip to content

test_socket control-message truncation tests fail on OpenBSD and DragonFly #154240

Description

@serhiy-storchaka

Bug report

Several recvmsg() control-message truncation tests in test_socket fail on OpenBSD 7 and DragonFly 6:

testCmsgTrunc1, testCmsgTrunc2Int, testCmsgTruncLen0, testCmsgTruncLen0Minus1,
testCmsgTruncLen0Plus1, testCmsgTruncLen1, testCmsgTruncLen2Minus1,
testSingleCmsgTrunc1, testSingleCmsgTrunc2Int, testSingleCmsgTruncInData,
testSingleCmsgTruncLen0Minus1, testSecondCmsgTrunc1, testSecondCmsgTrunc2Int,
testSecondCmsgTruncInData, testSecondCmsgTruncLen0Minus1

The tests pass an ancillary-data buffer deliberately too small and expect recvmsg() to return the data with MSG_CTRUNC set. On OpenBSD and DragonFly the call instead fails with OSError: [Errno 40] Message too long (EMSGSIZE):

  File ".../Lib/test/test_socket.py", line 3427, in doRecvmsg
    result = sock.recvmsg_into([buf], *args)
OSError: [Errno 40] Message too long

This is a kernel behavioral difference: these BSDs reject an undersized control buffer rather than truncating. NetBSD is unaffected (the truncation tests pass there, see gh-125860). FreeBSD and Linux are unaffected.

The tests should tolerate EMSGSIZE (or be skipped) on OpenBSD and DragonFly.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesOS-unsupportedtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions