-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-128881: Do not ignore address
and flags
parameters in socket.{send,recv}_fds
#128882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I have no idea what's happening on macOS. Should we just skip it on macOS? |
MSG_PEEK may got different action on macOS/FreeBSD, let's figure it out. BTW, we can skip the macOS test first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also have a test that combine both address
and flags
as well for send_fds
please? and see if we can have test coverage for Windows (just using a 0 flag for instance would be sufficient).
According to https://docs.python.org/3/library/socket.html#socket.send_fds, send_fds
and recv_fds
are is available on Windows and Unix, so we should be able to have tests for them as well.
Misc/NEWS.d/next/Library/2025-01-15-22-50-41.gh-issue-128881.JBL_9E.rst
Outdated
Show resolved
Hide resolved
address
and flags
parameters in socket.{send,recv}_fds
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
I found that FreeBSD doesn't seem to support receiving only 1 file descriptor with Here is a POC: https://fars.ee/Ih-8/c $ curl https://fars.ee/Ih-8 -o foo.c
$ cc -Wall -Wextra -Wpedantic -std=c17 foo.c && truss -o out.txt ./a.out && ggrep -E 'sendmsg|recvmsg' out.txt
sendmsg(3,{NULL,0,[{"Hello world!",12}],1,{{level=SOL_SOCKET,type=SCM_RIGHTS,data={0x01,0x00,0x00,0x00}}},20,0},0) = 12 (0xc)
recvmsg(4,{NULL,0,[{"Hello world!",12}],1,{},0,MSG_CTRUNC},0) = 12 (0xc)
$ gsed -i 's|fds\[\] = {1}|fds[] = {1, 2}|' foo.c
$ cc -Wall -Wextra -Wpedantic -std=c17 foo.c && truss -o out.txt ./a.out && ggrep -E 'sendmsg|recvmsg' out.txt
sendmsg(3,{NULL,0,[{"Hello world!",12}],1,{{level=SOL_SOCKET,type=SCM_RIGHTS,data={0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00}}},24,0},0) = 12 (0xc)
recvmsg(4,{NULL,0,[{"Hello world!",12}],1,{{level=SOL_SOCKET,type=SCM_RIGHTS,data={0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00}}},24,0},0) = 12 (0xc) |
update comments Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
fix 8d120f7
socket.send_fds
andsocket.recv_fds
#128881