Skip to content

Conversation

@naoNao89
Copy link
Contributor

Implements total_physical_memory() for macOS, FreeBSD, OpenBSD, and NetBSD using platform-specific sysctl commands. Enables sort -S 50% to work on all BSD-based systems.

Fixes #7257

@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch from 401a9fe to 8fae6fc Compare December 13, 2025 17:42
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch 4 times, most recently from 80fa255 to 34d1ef3 Compare December 13, 2025 18:43
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch from 34d1ef3 to f57d398 Compare December 13, 2025 19:58
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@lcheylus
Copy link
Contributor

LGTM for FreeBSD and OpenBSD to get "Total physical memory" via sysctl (libc or direct call).

Copy link
Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

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

this patch has a lot of duplication, could you please have a look? thanks

@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch from f57d398 to 6c0f36a Compare December 26, 2025 11:02
@github-actions
Copy link

GNU testsuite comparison:

Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.

…ions

- Implements total_physical_memory() for macOS (hw.memsize)
- Implements total_physical_memory() for FreeBSD (hw.physmem)
- Implements total_physical_memory() for OpenBSD (hw.physmem)
- Implements total_physical_memory() for NetBSD (hw.physmem64)
- Enables 'sort -S 50%' to work on all BSD-based platforms
- Updates tests to include percentage buffer sizes for BSD platforms

Fixes uutils#7257
@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch from 6c0f36a to 67839ab Compare December 28, 2025 21:59
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tty/tty-eof is no longer failing!

Replace subprocess-based sysctl calls with native libc::sysctl() syscalls
for macOS, FreeBSD, OpenBSD, and NetBSD to fix test_buffer_sizes failure
in CI environments.

The previous implementation spawned sysctl subprocesses which could fail
in sandboxed GitHub Actions runners. The native approach is more reliable,
performant, and includes subprocess fallback for robustness.

Fixes percentage-based buffer size parsing (e.g., sort -S 10%)
@naoNao89 naoNao89 force-pushed the feat/cross-platform-percent-buffer-size branch from 67839ab to e104905 Compare December 28, 2025 23:56
@github-actions
Copy link

GNU testsuite comparison:

Note: The gnu test tests/id/smack was skipped on 'main' but is now failing.
Note: The gnu test tests/mkdir/smack-no-root was skipped on 'main' but is now failing.
Note: The gnu test tests/mkdir/smack-root was skipped on 'main' but is now failing.

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.

sort: support percent arguments to -S option for non-Linux systems

3 participants