Skip to content
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

Fix error running tests on Linux kernel 5.13 or newer #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ssgelm
Copy link
Contributor

@ssgelm ssgelm commented Jan 13, 2022

As of torvalds/linux@1b8b208, unsupported ioctls now return ENOTTY instead of EINVAL. This change was also backported to the 5.10 stable branch, so it's a problem on the current release of many Linux distros now.

As of torvalds/linux@1b8b208,
unsupported ioctls now return ENOTTY instead of EINVAL. This change was
also backported to the 5.10 stable branch, so it's a problem on the
current release of many Linux distros now.
Copy link

@puellanivis puellanivis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -152,7 +153,7 @@ func checktty(t *testing.T, err error) {
t.Helper()
// some ioctls fail against char devices if they do not
// support a particular feature
if (runtime.GOOS == "darwin" && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {
if ((runtime.GOOS == "darwin" || runtime.GOOS == "linux") && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to put the (err == unix.EINVAL || err == unix.ENOTTY) together? Or maybe this is getting complex enough, we want to split it up in a switch?

🤷‍♀️ I mean, the code should work fine either way…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly either way. Happy to change it however you'd like, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants