-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/sys/unix: IoctlGetPtmget fail to get ptsname on NetBSD #66871
Comments
Change https://go.dev/cl/579476 mentions this issue: |
CC @golang/netbsd If I understand the bug report, it sounds like the fix should be to adjust the value of |
Yes, |
I'm sorry, I don't understand the question. |
Is the function |
No. |
Go version
go version go1.21.8 netbsd/amd64
Output of
go env
in your module/workspace:What did you do?
Although the test case
TestIoctlPtmget
passes on NetBSD, debugging revealed thatptm.Sn
is a byte array filled with zeros, thus preventing us from obtaining theptsname
. The log consistently showssfd = 0, ptsname =
, whereas under normal circumstances, we expect something likesfd = 0, ptsname = /dev/pts/0
to be displayed.Below is an example of relevant code for the
amd64
architecture.According to my investigation, this error is caused by the mismatch in the lengths of the arrays
Cn
andSn
within thePtmget
structure with the value ofTIOCPTSNAME
.In NetBSD: src/sys/sys/ttycom.h, we can find that the value of
TIOCPTSNAME
is related to the size ofPtmget
.When we set
PATH_MAX
to the currently used1024
in the code, the corresponding value forTIOCPTSNAME
should be0x48087448
, not the0x40287448
defined for386
/amd64
/arm64
(thearm
definition matches correctly).And when
TIOCPTSNAME
is0x40287448
as used in the current code, the correspondingPATH_MAX
should be16
. This indeed aligns with the description in the netbsd man page / ptm.I will submit a CL to fix this error shortly. This is my first time submitting a CL for Go. Please let me know if there's anything inappropriate or if you have any feedback.
What did you see happen?
None
What did you expect to see?
None
The text was updated successfully, but these errors were encountered: