-
Notifications
You must be signed in to change notification settings - Fork 360
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:
|
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.
👍 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.
@@ -155,9 +155,15 @@ void *memmem(const void *haystack, size_t haystack_length, | |||
#define IS_BIG_ENDIAN 0 | |||
#endif | |||
|
|||
#ifdef __OpenBSD__ |
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 - consider consistent macro style
While adding a check on the __OpenBSD__
here is wise, consider consistent macro style and re-use the #if defined(__OpenBSD__)
style (as above on line 148) to help future-proof this check against additional compiler portability.
This check on line 158 is only reached if the compiler already supported the defined(...)
macro after-all.
Please consider:
#ifdef __OpenBSD__ | |
#if defined(__OpenBSD__) |
🙇 hope this helps.
See Also around lines 243-249 for similar style suggestion
@@ -240,7 +246,12 @@ int posix_fallocate(int, off_t, off_t); | |||
#include <xlocale.h> | |||
#endif | |||
|
|||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) | |||
#ifdef __NetBSD__ |
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 - consider consistent macro style
Similar to before; TL;DR
While adding a pre-check on the __NetBSD__
here is good, consider consistent macro style and re-use the #if defined(__NetBSD__)
style (as followed on line 254) to help future-proof this check against additional compiler portability.
Please consider:
#ifdef __NetBSD__ | |
#if defined(__NetBSD__) && !defined(statfs) |
🙇 hope this helps.
See Also around line 158 for similar style suggestion
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.h
with the caveat of two minor style suggestions. See inline suggestions for details.
@@ -28,6 +37,11 @@ fi | |||
# And ones only gcc produces | |||
CFLAGS+=" -Wno-restrict -Wno-format-overflow" | |||
|
|||
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)
@@ -8,6 +8,10 @@ then | |||
exit 1 | |||
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.
@@ -4,6 +4,8 @@ | |||
|
|||
#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.
@@ -151,6 +151,10 @@ void check_help(char **arg) | |||
} | |||
} | |||
|
|||
#ifdef __NetBSD__ |
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 - Consider a consistent macro style
Similar to other files; TL;DR
Please consider:
#ifdef __NetBSD__ | |
#if defined(__NetBSD__) && !defined(uselocale) | |
// use a No-OP for NetBSD instead of uselocale() for compatability |
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. See suggestion on style inline.
No description provided.