Skip to content

sysctl: add -w/--write - #872

Open
Harp404 wants to merge 1 commit into
uutils:mainfrom
Harp404:sysctl-write
Open

Harp404 wants to merge 1 commit into
uutils:mainfrom
Harp404:sysctl-write

Conversation

@Harp404

@Harp404 Harp404 commented Dec 1, 2026

Copy link
Copy Markdown

sysctl -w name=value is the documented way to set a kernel parameter (and what most guides use), but -w was rejected even though sysctl name=value already writes:

$ sysctl -w net.ipv4.ip_forward=1
error: unexpected argument '-w' found

This adds -w/--write, with the procps-ng 4.0.4 behaviour for the two cases specific to it:

  • an argument without = is reported as command line(0): invalid syntax, continuing..., skipped, and the exit status is 1;
  • -w without variables fails with no variables specified.

Assignments are handled as before.

test_write_flag covers -w/--write with an assignment, a name without a value and no variables. It fails on main and passes with this change. cargo fmt and cargo clippy --all-targets -- -D warnings are clean.

I used Claude Code (Opus 5.5) to help investigate and draft this change; I reproduced the bug and checked the fix myself.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.72727% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.42%. Comparing base (67832aa) to head (383baf8).
⚠️ Report is 63 commits behind head on main.

Files with missing lines Patch % Lines
src/uu/sysctl/src/sysctl.rs 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #872      +/-   ##
==========================================
+ Coverage   19.20%   20.42%   +1.22%     
==========================================
  Files          68       68              
  Lines       10156    10145      -11     
  Branches      546      553       +7     
==========================================
+ Hits         1950     2072     +122     
+ Misses       8206     8073     -133     
Flag Coverage Δ
macos_latest ?
ubuntu_latest 20.83% <47.72%> (+1.27%) ⬆️
windows_latest 0.02% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants