fedora-sysv / initscripts

📜 Scripts to bring up network interfaces and legacy utilities in Fedora.
GNU General Public License v2.0
45 stars 51 forks source link

Fix splitting spaces in paths from statetab files #471

Closed deajan closed 5 months ago

deajan commented 5 months ago

Noticed that paths with spaces in /etc/statetab and /etc/statetab.d/* weren't interpreted. Since a for loop was used, bash just splitted paths at default IFS chars.

Since we could have paths with spaces like /opt/my service in statetab, we need to read the statetab files line per line, with IFS being '\n', which can be accomplished by using a while loop. This is already done for rwtab.

deajan commented 5 months ago

PR initially fixed defect SC2013. Got complaints from shellcheck about new SC2162 defect.

Initially wanted to code comply with current implementation of readonly-root script where rwtab's while loop didn't mangle backspaces (no SC2162 fix).

So updated this PR to fix SC2162 including the one from rwtab's while loop.

Has been tested on a couple of RHEL 9 setups with both rwtab and statetab entries.

[EDIT] I understand that readonly-root is deprecated. But it still has full RHEL 9 support until 2031, so I do think it's a good idea to have that little bug fix included :) [/EDIT]