-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sort: Allow percentages as values for buffer-size #4059
Conversation
GNU testsuite comparison:
|
Thanks |
Added the tests! |
GNU testsuite comparison:
|
yeah, it is a priority to keep all jobs green, sorry :) |
Fixes issue uutils#3500 by adding support for percentags of total memory for the buffer-size flag. The sysinfo crate is used to determine the total memory of a system. Usage of sysinfo instead of custom code makes this part very multi-platform compatible (See sysinfo documentation for supported OSes). As well as avoiding introducing unsafe code from libc's sysinfo.
Added crossplattform support by implementing get_total_memory seperately for linux,macos and windows using nix, libc and windows-sys.
… systems. Tests with percentages of total memory failed on 32bit system since the testsystems had more than 2^32 Byte of memory.
Ok I rewrote that part with platform-specific code. I had to disable some tests on 32-bit since the CI/CD Pipeline has more than 2^32 bit of total ram. |
GNU testsuite comparison:
|
What are the next steps now? I restarted the CI pipeline on the branch which made the macos build pass. So only the android test job fails (which it also does on them main branch). See https://github.com/sallto/coreutils/actions/runs/3383769224 |
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.
needs to be rebased
@sallto ping? |
no action for a while, closing. |
Fixes issue #3500 by adding support for percentags of total memory for the buffer-size flag. The sysinfo crate is used to determine the total memory of a system.
I used the sysinfo crate instead of hacking together unsafe code to work with libc. This makes the changed part crossplatform-compatible and realistically safer since sysinfo is a well maintained and actively developed library.
I used the error handling from the original code. The original program will default to using all of the memory of a system (not just available), while this implementation will panic with an error.
lmk if there are weird things I did as this is my first "production" rust code. Thanks!