-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sysctl.present replaces spaces by tabs #40054
Labels
Bug
broken, incorrect, or confusing behavior
P2
Priority 2
Platform
Relates to OS, containers, platform-based utilities like FS, system based apps
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
stale
Milestone
Comments
gtmanfred
added
Bug
broken, incorrect, or confusing behavior
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
P2
Priority 2
Platform
Relates to OS, containers, platform-based utilities like FS, system based apps
TEAM Platform
labels
Mar 15, 2017
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
please reopen |
Just confirmed that the behavior is still the same in salt 3000.2. |
bdrung
added a commit
to bdrung/salt
that referenced
this issue
Jan 13, 2022
`salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: saltstack#40054 Forwarded: saltstack#61452 Signed-off-by: Benjamin Drung <[email protected]>
bdrung
added a commit
to bdrung/salt
that referenced
this issue
Feb 4, 2022
`salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: saltstack#40054 Signed-off-by: Benjamin Drung <[email protected]>
bdrung
added a commit
to bdrung/salt
that referenced
this issue
Apr 15, 2022
`salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: saltstack#40054 Forwarded: saltstack#61452 Signed-off-by: Benjamin Drung <[email protected]> Gbp-Pq: Name linux_sysctl.present-Fix-replacing-spaces-by-tabs.patch
bdrung
added a commit
to bdrung/salt
that referenced
this issue
Apr 16, 2022
`salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: saltstack#40054 Forwarded: saltstack#61452 Signed-off-by: Benjamin Drung <[email protected]> Gbp-Pq: Name linux_sysctl.present-Fix-replacing-spaces-by-tabs.patch
bdrung
added a commit
to bdrung/salt
that referenced
this issue
Apr 16, 2022
`salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: saltstack#40054 Forwarded: saltstack#61452 Signed-off-by: Benjamin Drung <[email protected]> Gbp-Pq: Name linux_sysctl.present-Fix-replacing-spaces-by-tabs.patch
garethgreenaway
added a commit
that referenced
this issue
Sep 23, 2022
…conf files (#61452) * test_linux_sysctl: Reduce indentation level Reduce indentation level to improve readability. Signed-off-by: Benjamin Drung <[email protected]> * test_linux_sysctl: Fix test_persist_no_conf_failure `test_persist_no_conf_failure` has different behaviour depending on the operating system it is executed on. Mock all system calls and let it fail in the first try to write the sysctl configuration file. Signed-off-by: Benjamin Drung <[email protected]> * linux_sysctl: Pass parameters as list to cmd.run Signed-off-by: Benjamin Drung <[email protected]> * linux_sysctl.show: Fix parsing of sysctl.conf files The lines in sysctl.conf files can contain leading and trailing spaces. The equal sign (that separates the key and value) might have zero to multiple white spaces. Valid example: ``` kernel.core_pattern = |/usr/share/kdump-tools/dump-core %p %s %t %e # Stop low-level messages on console = less logging kernel.printk = 3 4 1 3 net.ipv4.ip_forward=1 ``` `sysctl.show` currently has two issues: * all values contain a trailing newline * Comments with leading spaces and equal sign in them are not skipped Address both issues and simplify the code and cover them with unit tests. Signed-off-by: Benjamin Drung <[email protected]> * linux_sysctl.present: Fix replacing spaces by tabs `salt/modules/linux_sysctl.py` tries to be smart in `persist()` and replaces spaces by tabs, which will be correct for keys like `net.ipv4.tcp_rmem` but not for `kernel.core_pattern`. So only sanitize the values for comparison, but not for persisting them in the configuration file. Bug: #40054 Signed-off-by: Benjamin Drung <[email protected]> * linux_sysctl: Drop unreachable code The check `if "=" not in line` already ensures that the split by `=` will return two elements. Signed-off-by: Benjamin Drung <[email protected]> * fixing failing tests * need to mock which in test_assign_success Signed-off-by: Benjamin Drung <[email protected]> Co-authored-by: Benjamin Drung <[email protected]> Co-authored-by: Gareth J. Greenaway <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
broken, incorrect, or confusing behavior
P2
Priority 2
Platform
Relates to OS, containers, platform-based utilities like FS, system based apps
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
stale
Description of Issue/Question
salt/modules/linux_sysctl.py
tries to be smart inpersist()
and replaces spaces by tabs:This behavior exists since at least salt 0.11. Sadly following state:
leads to following setting:
There is a difference between tabs and spaces for this setting!
Versions Report
The text was updated successfully, but these errors were encountered: