On Tue, Feb 21, 2023 at 12:46:11PM +0100, Mike Fischer wrote: > > > Am 21.02.2023 um 12:00 schrieb Crystal Kolipe <kolip...@exoticsilicon.com>: > > > > On Tue, Feb 21, 2023 at 11:29:17AM +0100, jhx wrote: > >> this patch adds the "-p" option to sysctl which makes it possible to > >> read/parse/apply settings from /etc/sysctl.conf at any time the user > >> wishes. > > > > This is an interesting idea, but you can effectively do the same thing > > from the shell with: > > > > # sysctl `cat /etc/sysctl.conf` > > > > Also, note that both your patch and the above shell command do not > > gracefully handle comment lines in /etc/sysctl.conf, (although that > > shouldn't cause any problem in practice). > > Also there is a difference between the use of /etc/sysctl.conf at boot and > when using either the proposed -p option or the shell command: At boot we > start out with the default values. When re-reading /etc/sysctl.conf the > current state is the base. That is very relevant if you e.g. remove a line > from /etc/sysctl.conf (to go back to the default).
Agreed. Also, the main use of this would presumably be to test a new configuration in /etc/sysctl.conf without rebooting. The problem here is that when /etc/sysctl.conf is read by /etc/rc, this is done before kern.securelevel is raised. The upshot of this is that we can never fully implement the idea, because if you put, for example: hw.allowpowerdown=0 in /etc/sysctl.conf, then you will get different behaviour re-loading the config without rebooting, (the value won't change), to that which you get when rebooting, (the new value of 0 will be set). So at the very least, this limitation would probably need to be mentioned in the manual page.