Page MenuHomeFreeBSD

sysctl: emit a newline after NULL node descriptions
ClosedPublic

Authored by emaste on Oct 6 2023, 6:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 10:10 PM
Unknown Object (File)
Sun, Oct 27, 10:10 PM
Unknown Object (File)
Sun, Oct 27, 10:09 PM
Unknown Object (File)
Sun, Oct 27, 9:48 PM
Unknown Object (File)
Thu, Oct 17, 10:50 PM
Unknown Object (File)
Sep 22 2024, 11:42 PM
Unknown Object (File)
Sep 22 2024, 7:57 PM
Unknown Object (File)
Sep 20 2024, 4:30 PM
Subscribers

Details

Summary
Previously when printing the sysctl description (via the -d flag) we
omitted the newline if the node provided no description (i.e., NULL).
This could be observed via e.g. `sysctl -d dev`.

PR:             44034

(PR is a report of sysctls with empty descriptions, which is how I found this issue.)

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested review of this revision.Oct 6 2023, 6:04 PM
emaste created this revision.

Before:

$ sysctl -d dev | head -n 2
dev: dev.hconf: 
dev.hconf.0: 

After:

$ sbin/sysctl/obj/sysctl -d dev | head -n
2
dev: 
dev.hconf: 

Possible test addition:

atf_test_case sysctl_dflag_NULL
sysctl_dflag_NULL_head()
{
       atf_set "descr" "Verify newline after NULL description"
}
sysctl_dflag_NULL_head()
{
       atf_check -s exit:1 sysctl -d dev | head -n 1 | grep ":"
}
zlei added a subscriber: zlei.

Looks good to me.

This revision is now accepted and ready to land.Oct 10 2023, 2:39 AM