Skip to content

Conversation

agreppin
Copy link

No description provided.

@landley
Copy link
Owner

landley commented Jun 15, 2024

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...

@agreppin
Copy link
Author

please note that I only tested with this config:

CONFIG_TOYBOX_FORK=y
CONFIG_PRINTF=y
CONFIG_SORT_FLOAT=y
CONFIG_BASE64=y
CONFIG_HELP=y
CONFIG_GZIP=y
CONFIG_GUNZIP=y
CONFIG_ZCAT=y
CONFIG_TOYBOX=y
CONFIG_TOYBOX_LSM_NONE=y
CONFIG_TOYBOX_FLOAT=y
CONFIG_TOYBOX_HELP=y
CONFIG_TOYBOX_ZHELP=y
CONFIG_TOYBOX_DEBUG=y
CONFIG_TOYBOX_UID_SYS=100
CONFIG_TOYBOX_UID_USR=500

Copy link

@reactive-firewall reactive-firewall left a 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.

Comment on lines +647 to +649
#ifdef __OpenBSD__
#define syscall(...) -1
#endif

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.

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__

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:

Suggested change
#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__

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:

Suggested change
#ifdef __NetBSD__
#if defined(__NetBSD__) && !defined(statfs)

🙇 hope this helps.

See Also around line 158 for similar style suggestion

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;;

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

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

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__

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:

Suggested change
#ifdef __NetBSD__
#if defined(__NetBSD__) && !defined(uselocale)
// use a No-OP for NetBSD instead of uselocale() for compatability

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.

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.

3 participants