-
Notifications
You must be signed in to change notification settings - Fork 36
implemented mkswap #292
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: main
Are you sure you want to change the base?
implemented mkswap #292
Conversation
i guess you saw that a bunch of jobs are failing |
It is proving more difficult than expected to make it successfully not work on non-linux platforms :D |
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.
Pull Request Overview
This pull request implements a minimal version of the mkswap utility for Linux, including a basic swap signature initialization and several tests to cover error and success scenarios. Key changes include:
- Addition of new tests for mkswap in tests/by-util/test_mkswap.rs and tests/tests.rs.
- Implementation of the mkswap functionality in src/uu/mkswap/src/mkswap.rs.
- Updates to Cargo.toml files and documentation to integrate the new utility into the workspace.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/tests.rs | Added mkswap test module to conditionally compile tests. |
tests/by-util/test_mkswap.rs | Introduced tests covering various mkswap error and success cases. |
src/uu/mkswap/src/mkswap.rs | Implemented the core mkswap functionality and swap signature logic. |
src/uu/mkswap/src/main.rs | Defined the main entry point for the new mkswap utility. |
src/uu/mkswap/mkswap.md | Added basic documentation for mkswap usage. |
src/uu/mkswap/Cargo.toml | Provided package configuration for mkswap. |
Cargo.toml | Updated workspace dependencies to include the mkswap package. |
Comments suppressed due to low confidence (1)
src/uu/mkswap/src/mkswap.rs:97
- Consider checking that the label length does not exceed the 16-byte buffer size before copying to avoid a potential buffer overflow. For example, truncate the label if its length is greater than 16.
(*swap_hdr).volume_name.as_mut_ptr().copy_from(label.as_ptr(), label.len());
…ng logic, removed assertions, made pagesize immutable.
A minimal implementation of mkswap
features lacking from the original:
tested on an archiso with an 8GB swap partition