[pve-devel] [PATCH installer v2 1/3] low level: config: filter out kernel cmdline on word boundaries
Christoph Heiss
c.heiss at proxmox.com
Wed Aug 21 15:23:00 CEST 2024
Otherwise, substrings might get replaced, e.g. the replacement
`proxmox-start-auto-installer` -> `pxmox-start-auto-installer` would be
done.
Fixes: a02a78a ("fix #4747: pass kernel cmdline parameters to target system")
Suggested-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Changes v1 -> v2:
* split commandline along whitespace and filter individually, to avoid
problems with regexes and word boundaries
Proxmox/Install/Config.pm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Proxmox/Install/Config.pm b/Proxmox/Install/Config.pm
index ae70093..7378d86 100644
--- a/Proxmox/Install/Config.pm
+++ b/Proxmox/Install/Config.pm
@@ -43,10 +43,12 @@ my sub parse_kernel_cmdline {
}
}
- $cmdline =~ s/(?:BOOT_IMAGE|root|ramdisk_size|splash|vga)=\S+\s?//gi;
- $cmdline =~ s/ro|rw|quiet|proxdebug|proxtui|nomodeset//gi;
+ my @filtered = grep {
+ $_ !~ m/^(BOOT_IMAGE|root|ramdisk_size|splash|vga)=\S+$/ &&
+ $_ !~ m/^(ro|rw|quiet|proxdebug|proxtui|nomodeset)$/
+ } split(/\s+/, $cmdline);
- $cfg->{target_cmdline}= $cmdline;
+ $cfg->{target_cmdline} = join(' ', @filtered);
return $cfg;
}
--
2.45.2
More information about the pve-devel
mailing list