Page MenuHomeFreeBSD

Add support for sysctl.conf.d
Needs ReviewPublic

Authored by antranigv_freebsd.am on Sep 24 2021, 11:36 PM.

Details

Reviewers
kevans
Group Reviewers
manpages

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 41744
Build 38633: arc lint + arc unit

Event Timeline

0mp added inline comments.
libexec/rc/rc.d/sysctl
30

Is there any guarantee about the order of globbing here? I took a quick look at the sh manual page but i couldn't find anything relevant right away.

libexec/rc/rc.d/sysctl
30

Apologies, I don't understand what order of globbing means. Can you elaborate?

libexec/rc/rc.d/sysctl
30

Sure! So when you run a command like echo * you are going to echo all the file names in the directory to stdout. That's something we all know. Now, I wonder if the list of matching filenames is always sorted. Usually, it is, but I'm not sure if that's a guarantee.

Side note: I'd expect this to be described in subsection "Pathname Expansion (File Name Generation)" in the manual for sh(1) but it isn't.

In the end, I wonder if you can control the order your /etc/sysctl.conf.d/*.conf are sourced.

libexec/rc/rc.d/sysctl
30

Oh, I see now!

I ran this in FreeBSD, looks like they are string sorted.

$ for _f in ./*.conf; do
echo ${_f}
done
./01-foo.conf
./02-bar.conf
./1-baz.conf
./10-z.conf
./12-bar.conf
./2-baz.conf
./bar.conf
./foo.conf
./z.conf
jilles added inline comments.
libexec/rc/rc.d/sysctl
30

POSIX requires pathname generation to sort according to the current locale's collating sequence, and FreeBSD sh and other shells implement this (although older implementations might sort by character code).

This piece of information is indeed missing from the sh(1) manual page.