-
Notifications
You must be signed in to change notification settings - Fork 391
portability for {Free,Net,Open,}BSD #505
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: master
Are you sure you want to change the base?
Conversation
|
Touches more files at once than I'm happy with. (The test suite plumbing tends to use SKIP rather than if around the tests, to avoid running different NUMBERS of tests on different targets, and silently skipping tests without saying "SKIP:")... Came to the web interface to see if the 1/2 that got squished together by wget 505.patch provided better granularity, but doesn't look like it. (I can break it up easily enough, but then either I'm faking metadata or don't attribute it properly...) I'll take a swing at it... |
|
please note that I only tested with this config: |
reactive-firewall
left a comment
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.
I did a partial Review in hopes that it helps @landley, and the changes to lib/protability.* are trivial, I'll recommend further review of scripts specificly in the case of toybox's long-term plans.
See specific comments inline.
🙇 Hope this helps.
| #ifdef __OpenBSD__ | ||
| #define syscall(...) -1 | ||
| #endif |
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.
🧹 NIT - Plea for a comment here.
Rational - It would be nice (but not strictly not necessary) to have a comment about why this portability trick is done for OpenBSD for those of us not yet initiated.
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.
syscall(2) is not available anymore on OpenBSD for common mortals
https://undeadly.org/cgi?action=article;sid=20231213062827
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.
👍 LGTM; Regarding lib/portability.c
I see no issue adding the || defined(__NetBSD__) checks (:speak_no_evil: as long as the NetBSD headers don't fall under GPL or something that might prevent inclusion, etc.) as they are straightforward.
See also 🧹 NIT suggestion inline regarding adding a helpful comment.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
|
||
| case "$(uname)" in | ||
| 'NetBSD'|'OpenBSD') | ||
| unset ASAN;; |
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.
😕 does OpenBSD really have issues with address sanitation? Please explain for those of us who are uninitiated. (🙏 with small, gentle words please)
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.
this is a quick hack to be able to run the tests. The base config of NetBSD, OpenBSD (and Alpine Linux / musl-libc), does not have a CC with -fsanitize=address.
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.
🙇 Thanks for the explanation, I was unaware.
🙊 and I can almost hear the musl libc devs strictly claiming the lack of a check here is a bug too . 🙄
perhaps consider a comment:
| unset ASAN;; | |
| #TODO: add compiler check for '-fsanitize=address' (e.g., $CC -h 2>1 | grep 'args') | |
| unset ASAN;; # otherwise assume no compiler support by default |
| fi | ||
|
|
||
| case ${OD-} in | ||
| '') OD=$(command -v god || command -v ggod || echo od);; # use od from GNU coretutils |
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.
🙅 This change concerns me by deliberately introducing a reliance on "GNU coretutils" and places the original od command at the end of the chained-or-logic lending to a preference on GNU.
Perhaps at least consider maintaining od at the start of the logic. Otherwise please add a comment for why this logic is needed for those of us yet uninitiated.
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.
not all /bin/od are equals, the test suite seems biased toward a specific implementation of od.
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.
| '') OD=$(command -v god || command -v ggod || echo od);; # use od from GNU coretutils | |
| '') OD=$(command -v god || command -v ggod || echo od);; # use od from GNU coretutils for GNU biased tests |
|
|
||
| #testing "name" "command" "result" "infile" "stdin" | ||
|
|
||
| HEAD=$(command -v ghead || echo head) # use head from GNU coreutils |
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.
😕 Similar to before in scripts/portability.sh this preference for GNU variants concerns me. Please consider maintaining the preference for the original variant in the chained-or-logic. Otherwise please enlighten us uninitiated about why NetBSD would require this.
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.
I don't remember now, seems a similar issue ... some tests fails with head and not with ghead.
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.
🤔 Odd; unless ghead expands the 2.gz file before reporting the first 10 bytes (e.g., $HEAD -c 10 2.gz) I don't see why a BSD-Like head would behave different from ghead in this use-case.
perhaps a -o pipefail somewhere or similar side-efect issue 🤷
🤷 LGTM; Using a variable is maintainable enough.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
👍 LGTM; Regarding main.c the no-op implementation for uselocale is straight forward, and targeted at NetBSD.
|
Thanks for the review, I will rework that PR, when time permits. |
Co-authored-by: Mr. Walls <reactive-firewall@users.noreply.github.com>
Co-authored-by: Mr. Walls <reactive-firewall@users.noreply.github.com>
Co-authored-by: Mr. Walls <reactive-firewall@users.noreply.github.com>
reactive-firewall
left a comment
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.
👍 LGTM; See suggested NIT suggestion/comments inline.
@landley this is probably ready for you to review.
🙇 I hope this helps.
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.
👍 again LGTM; Regarding lib/portability.h the changes are now well styled and trivial.
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.
👍 LGTM; Regarding main.c the no-op implementation for uselocale is straight forward, and targeted at NetBSD.
|
|
||
| case "$(uname)" in | ||
| 'NetBSD'|'OpenBSD') | ||
| unset ASAN;; |
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.
🙇 Thanks for the explanation, I was unaware.
🙊 and I can almost hear the musl libc devs strictly claiming the lack of a check here is a bug too . 🙄
perhaps consider a comment:
| unset ASAN;; | |
| #TODO: add compiler check for '-fsanitize=address' (e.g., $CC -h 2>1 | grep 'args') | |
| unset ASAN;; # otherwise assume no compiler support by default |
|
|
||
| #testing "name" "command" "result" "infile" "stdin" | ||
|
|
||
| HEAD=$(command -v ghead || echo head) # use head from GNU coreutils |
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.
🤔 Odd; unless ghead expands the 2.gz file before reporting the first 10 bytes (e.g., $HEAD -c 10 2.gz) I don't see why a BSD-Like head would behave different from ghead in this use-case.
perhaps a -o pipefail somewhere or similar side-efect issue 🤷
🤷 LGTM; Using a variable is maintainable enough.
No description provided.