2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 04:27:55 +00:00

fix(enablekdump): anchor the root= strip on a token boundary

The strip used \b, a regex word boundary, which also exists after
punctuation such as - and . inside a token. An unrelated option ending
in root=, for example foo-root=bar or rd.foo.root=bar, lost its tail
and left garbage like foo- behind.

Require a real command-line token boundary instead: the opening quote
or whitespace. The captured delimiter is kept and the substitution
loops, so consecutive stale root= tokens are still all removed.
This commit is contained in:
Vinícius Ferrão
2026-08-18 14:04:18 -03:00
parent def36c0444
commit 6b9891b6de
+4 -2
View File
@@ -265,8 +265,10 @@ EOF
[ -e $MOUNTPATH/$NODE/proc ] || echo "xCAT: dummy /proc so RHEL7 dracut-cmdline accepts root=" > $MOUNTPATH/$NODE/proc
# Drop any root= a previous run left behind before adding this
# node's own: dracut takes the last root= on the command line,
# so a stale shared-root value would win over the new one.
sed -i -e '/^[\t ]*KDUMP_COMMANDLINE_APPEND="/s/\broot=[^ \t"]*[ \t]*//g' \
# so a stale shared-root value would win over the new one. A
# root= token starts after the opening quote or whitespace,
# so suffixes of other options (foo-root=, rd.foo.root=) stay.
sed -i -e '/^[\t ]*KDUMP_COMMANDLINE_APPEND="/{:a;s/\([" \t]\)root=[^ \t"]*[ \t]*/\1/;ta}' \
-e "s#^[\t ]*KDUMP_COMMANDLINE_APPEND=\"#KDUMP_COMMANDLINE_APPEND=\"root=nfs:$KDIP:$KDPATH/$NODE #" /etc/sysconfig/kdump
fi
[ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf