diff options
author | Craig Small <csmall@dropbear.xyz> | 2022-04-09 14:18:28 +1000 |
---|---|---|
committer | Craig Small <csmall@dropbear.xyz> | 2022-04-09 14:18:28 +1000 |
commit | b159c198c9160a8eb13254e2b631d0035b9b542c (patch) | |
tree | ffe148b2391b0ea4d8074fbcedcb987b92ac5ebb /testsuite | |
parent | 4fbf8d22a99445bc7b37c6d36ed9e045821439e3 (diff) | |
download | procps-ng-b159c198c9160a8eb13254e2b631d0035b9b542c.tar.gz |
sysctl: print dotted keys again
When the globbing update was put into sysctl, you could no longer
simply use the keys because one key could potentially be
multiple paths once the glob expansion occured. Using the path
instead gave a unique output.
Except certain programs, such as salt, expected the output to use
the dotted path "kernel.hostname" and not "kernel/hostname".
We can no longer use the original key, so now for each path:
Copy the path
strip off /proc/
convert all / to .
The sysctl testsuite was also updated to check for a few different
types of conversion failures.
References:
commit 6389deca5bf667f5fab5912acde78ba8e0febbc7
https://www.freelists.org/post/procps/some-procpsn4400-fixes,4
https://repo.saltproject.io/
Signed-off-by: Craig Small <csmall@dropbear.xyz>
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/sysctl.test/sysctl_write.exp | 14 | ||||
-rw-r--r-- | testsuite/sysctl_slash_test.conf | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/testsuite/sysctl.test/sysctl_write.exp b/testsuite/sysctl.test/sysctl_write.exp index bf0923f..b6b9443 100644 --- a/testsuite/sysctl.test/sysctl_write.exp +++ b/testsuite/sysctl.test/sysctl_write.exp @@ -3,11 +3,19 @@ set sysctl ${topdir}sysctl set test "sysctl write from command line" spawn $sysctl --dry-run kernel.hostname=procps-test -expect_pass "$test" "/proc/sys/kernel/hostname = procps-test" +expect_pass "$test" "kernel.hostname = procps-test" + +set test "sysctl write from command line using slash" +spawn $sysctl --dry-run kernel/hostname=procps-test +expect_pass "$test" "kernel.hostname = procps-test" set test "sysctl write from configuration file" spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_glob_test.conf -expect_pass "$test" "/proc/sys/fs/protected_fifos = 2\\s+/proc/sys/fs/protected_symlinks = 2\\s+/proc/sys/fs/protected_hardlinks = 1" +expect_pass "$test" "fs.protected_fifos = 2\\s+fs.protected_symlinks = 2\\s+fs.protected_hardlinks = 1" + +set test "sysctl write from file with slashes" +spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_slash_test.conf +expect_pass "$test" "kernel.hostname = procps-test" set hostname_file "/proc/sys/kernel/hostname" if {[file exists ${hostname_file}]} { @@ -25,7 +33,7 @@ if {[file exists ${hostname_file}]} { expect_spawn_retval "$test" 0 } } else { - unsupported "sysctl write: hostname file doe not exist" + unsupported "sysctl write: hostname file does not exist" } set test "sysctl write above /proc" diff --git a/testsuite/sysctl_slash_test.conf b/testsuite/sysctl_slash_test.conf new file mode 100644 index 0000000..77e9b37 --- /dev/null +++ b/testsuite/sysctl_slash_test.conf @@ -0,0 +1 @@ +kernel/hostname = procps-test |