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 testcases regarding O_NONBLOCK on parisc/hppa architecture #2128

Merged
1 commit merged into from Feb 8, 2021
Merged

Fix testcases regarding O_NONBLOCK on parisc/hppa architecture #2128

1 commit merged into from Feb 8, 2021

Conversation

hdeller
Copy link
Contributor

@hdeller hdeller commented Feb 2, 2021

On the parisc/hppa architecture, the O_NONBLOCK constant can be either
000200000 or 000200004, depending on the Linux kernel and glibc version
on which the binary is running.
Background of this can be read in this upstream Linux kernel patch:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75ae04206a4d0e4f541c1d692b7febd1c0fdb814

The tor testcases fail because of this, because function
fd_is_nonblocking() checks hard against the O_NONBLOCK value, while it's
sufficient if it would only check if one of the bits is set.

Fix this trivial issue by just comparing if the returned file descriptor flag
and'ed with O_NONBLOCK is non-zero.

As reference, a failing build on parisc/hppa can be seen here:
https://buildd.debian.org/status/fetch.php?pkg=tor&arch=hppa&ver=0.4.4.6-1%2Bb1&stamp=1612225628&raw=0

On the parisc/hppa architecture, the O_NONBLOCK constant can be either
000200000 or 000200004, depending on the Linux kernel and glibc version
on which the binary is running.
Background of this can be read in this upstream Linux kernel patch:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75ae04206a4d0e4f541c1d692b7febd1c0fdb814

The tor testcases fail because of this, because function
fd_is_nonblocking() checks hard against the O_NONBLOCK value, while it's
sufficient if it would only check if one of the bits is set.

Fix this trivial issue by just comparing if the returned file descriptor flag
and'ed with O_NONBLOCK is non-zero.

As reference, a failing build on parisc/hppa can be seen here:
https://buildd.debian.org/status/fetch.php?pkg=tor&arch=hppa&ver=0.4.4.6-1%2Bb1&stamp=1612225628&raw=0
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10755

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 13 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 64.501%

Files with Coverage Reduction New Missed Lines %
src/feature/dirauth/shared_random.c 4 85.0%
src/feature/dirauth/dirvote.c 9 68.12%
Totals Coverage Status
Change from base Build 10750: -0.02%
Covered Lines: 52057
Relevant Lines: 80707

💛 - Coveralls

@weaselp
Copy link

weaselp commented Feb 3, 2021

If changing the constants is a thing that happens, I wonder if the return (flags & FD_CLOEXEC) == FD_CLOEXEC; from a few lines before that should be equally changed.

@hdeller
Copy link
Contributor Author

hdeller commented Feb 3, 2021 via email

@ghost ghost merged commit d21ad8a into torproject:master Feb 8, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants