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)
Fri, Nov 8, 6:02 AM
Unknown Object (File)
Fri, Nov 8, 3:05 AM
Unknown Object (File)
Oct 27 2024, 10:10 PM
Unknown Object (File)
Oct 27 2024, 10:10 PM
Unknown Object (File)
Oct 27 2024, 10:09 PM
Unknown Object (File)
Oct 27 2024, 9:48 PM
Unknown Object (File)
Oct 17 2024, 10:50 PM
Unknown Object (File)
Sep 22 2024, 11:42 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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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