From 6b9891b6de2256a6891ae5e331ed789ac7077869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 18 Aug 2026 14:04:18 -0300 Subject: [PATCH] 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. --- xCAT/postscripts/enablekdump | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index f52fb414c..c5f12803c 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -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