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.

Copy link
Author

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

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.


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)

Copy link
Author

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.

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:

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

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.

Copy link
Author

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.

Choose a reason for hiding this comment

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

Suggested change
'') 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

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.

Copy link
Author

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.

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.

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.

@agreppin
Copy link
Author

agreppin commented Oct 6, 2025

Thanks for the review, I will rework that PR, when time permits.

agreppin and others added 3 commits October 6, 2025 07:25
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>
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.

👍 LGTM; See suggested NIT suggestion/comments inline.

@landley this is probably ready for you to review.

🙇 I hope this helps.

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.

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

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:

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

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.

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