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

Portability cleanup setsockopt() calls #1359

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

Conversation

yadij
Copy link
Contributor

@yadij yadij commented May 20, 2023

error: cannot convert 'int*' to 'const char*'

Ensure that parameter 4 is cast properly to char* which is
known to be compatible with all known API declarations
for this function.

Ensure that parameter 5 is passed the size of object in
parameter 4 whenever possible, instead of the theoretical
type size.

rousskov

This comment was marked as resolved.

@rousskov rousskov added the S-waiting-for-PR Closure of other PR(s), current or future, is expected (and usually required) label May 20, 2023
@yadij yadij removed the S-waiting-for-PR Closure of other PR(s), current or future, is expected (and usually required) label May 20, 2023
@yadij

This comment was marked as resolved.

@yadij yadij requested a review from rousskov May 20, 2023 23:16
@yadij yadij added the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label May 20, 2023
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
@rousskov rousskov removed the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label May 20, 2023
@yadij yadij added the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label May 21, 2023
@yadij yadij requested a review from rousskov May 21, 2023 01:03
@rousskov rousskov removed their request for review May 22, 2023 01:32
@rousskov rousskov removed the S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box label May 22, 2023
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
src/ip/QosConfig.cc Show resolved Hide resolved
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
@rousskov rousskov added the S-waiting-for-author author action is expected (and usually required) label May 22, 2023
@yadij yadij requested a review from rousskov May 22, 2023 16:33
@yadij yadij added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels May 22, 2023
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
src/ip/QosConfig.cc Outdated Show resolved Hide resolved
@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels May 22, 2023
@yadij yadij requested a review from rousskov May 24, 2023 17:07
@yadij yadij added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels May 24, 2023
@yadij yadij changed the title MinGW-w64: fix TOS socket API Portability cleanup setsockopt() calls May 24, 2023
src/WinSvc.cc Outdated
@@ -965,7 +965,7 @@ static int Win32SockInit(void)
} else {
opt = opt | SO_SYNCHRONOUS_NONALERT;

if (::setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, optlen)) {
if (::setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, reinterpret_cast<char *>(&opt), optlen)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to change so many callers, like the current PR iteration does, then we should polish/generalize and make our SetSocketOption() available to this and similar code, allowing us to move all the current ugly and poorly duplicated manual casts into one place.

The same approach will correctly handle the last/size arguments with less noise and fewer opportunities for bugs.

FWIW, I am happy to help with generalizing/polishing the existing SetSocketOption() code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As demonstrated in PR #1373 this is a deceptive request. Acceding will result in a fall down the slippery slope of ever increasing perfection requests. Throwing this PR further out of the intended scope of fixing a few MinGW compile errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

As demonstrated in PR #1373 this is a deceptive request. Acceding will result in a fall down the slippery slope of ever increasing perfection requests. Throwing this PR further out of the intended scope of fixing a few MinGW compile errors.

I disagree with the above assessment and speculation. However, may not need to agree on this to make progress: If you refactor this PR so that it is just "fixing a few MinGW compile errors", without modifying so many setsockopt() calls (most of which are not specific and some are probably not even applicable to MinGW builds), then this change request will become stale/inapplicable and can be resolved on those grounds. I do not know whether (and am not implying that) such refactoring is possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT, this change request has not been addressed when PR branch was force-pushed from 02b82a1 to 213df95 and my re-review requested a few hours ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was addressed by authors decision not to implement your requested change.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT, this change request has not been addressed when PR branch was force-pushed from 02b82a1 to 213df95 and my re-review requested a few hours ago.

It was addressed by authors decision not to implement your requested change.

Thank you for disclosing that decision; I was not aware of that decision when my re-review was requested.

This change request stands. Doing nothing does not address my blocking concern.

@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels May 24, 2023
@yadij
Copy link
Contributor Author

yadij commented Jun 3, 2023

Waiting on PR #1373

@yadij yadij added the S-waiting-for-PR Closure of other PR(s), current or future, is expected (and usually required) label Jun 3, 2023
@yadij yadij removed the S-waiting-for-PR Closure of other PR(s), current or future, is expected (and usually required) label Jun 4, 2023
@yadij
Copy link
Contributor Author

yadij commented Jun 4, 2023

No longer going to wait for PR #1373 which has already started devolving into requests for perfection.

@yadij yadij requested a review from rousskov June 4, 2023 17:26
@yadij yadij added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels Jun 4, 2023
src/WinSvc.cc Outdated
@@ -965,7 +965,7 @@ static int Win32SockInit(void)
} else {
opt = opt | SO_SYNCHRONOUS_NONALERT;

if (::setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, optlen)) {
if (::setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, reinterpret_cast<char *>(&opt), optlen)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As demonstrated in PR #1373 this is a deceptive request. Acceding will result in a fall down the slippery slope of ever increasing perfection requests. Throwing this PR further out of the intended scope of fixing a few MinGW compile errors.

I disagree with the above assessment and speculation. However, may not need to agree on this to make progress: If you refactor this PR so that it is just "fixing a few MinGW compile errors", without modifying so many setsockopt() calls (most of which are not specific and some are probably not even applicable to MinGW builds), then this change request will become stale/inapplicable and can be resolved on those grounds. I do not know whether (and am not implying that) such refactoring is possible.

@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Jun 4, 2023
@squid-anubis squid-anubis added M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels and removed M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels labels Aug 8, 2023
@squid-anubis squid-anubis added M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels and removed M-failed-other https://github.com/measurement-factory/anubis#pull-request-labels labels Jan 9, 2024
@kinkie kinkie added the M-ignored-by-merge-bots https://github.com/measurement-factory/anubis/blob/master/README.md#pull-request-labels label Feb 14, 2024
Ensure that parameter 4 is cast properly to char* which is
known to be compatible with all known API declarations
for this function.

Ensure that parameter 5 is passed the size of object in
parameter 4 whenever possible, instead of the theoretical
type size.
@yadij yadij added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) M-ignored-by-merge-bots https://github.com/measurement-factory/anubis/blob/master/README.md#pull-request-labels labels Nov 20, 2024
@yadij yadij requested a review from rousskov November 20, 2024 07:00
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

Please address the earlier change request at #1359 (comment)

@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Nov 20, 2024
@yadij
Copy link
Contributor Author

yadij commented Nov 21, 2024

Per @rousskov 12 Oct 2024: "Please do not block PRs just because you do not see value in them (when other core developers do see value)."

@rousskov
Copy link
Contributor

Alex: Please do not block PRs just because you do not see value in them (when other core developers do see value).

I am not blocking this PR because I do not see its value. I am currently blocking this PR because its value is overwhelmed by its harm, while addressing my concern (and reversing that relationship) does not require heroic efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-for-author author action is expected (and usually required)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants