From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer v3 1/3] low level: config: filter out kernel cmdline on word boundaries
Date: Mon, 11 Nov 2024 12:05:15 +0100 [thread overview]
Message-ID: <20241111110523.261482-2-c.heiss@proxmox.com> (raw)
In-Reply-To: <20241111110523.261482-1-c.heiss@proxmox.com>
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@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v2 -> v3:
* rebased on latest master
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 d604676..4152a77 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//gi;
+ my @filtered = grep {
+ $_ !~ m/^(BOOT_IMAGE|root|ramdisk_size|splash|vga)=\S+$/ &&
+ $_ !~ m/^(ro|rw|quiet|proxdebug|proxtui)$/
+ } split(/\s+/, $cmdline);
- $cfg->{target_cmdline}= $cmdline;
+ $cfg->{target_cmdline} = join(' ', @filtered);
return $cfg;
}
--
2.47.0
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-11-11 11:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 11:05 [pve-devel] [PATCH installer v3 0/3] properly filter out all installer-related kernel arguments Christoph Heiss
2024-11-11 11:05 ` Christoph Heiss [this message]
2024-11-11 11:05 ` [pve-devel] [PATCH installer v3 2/3] low level: config: " Christoph Heiss
2024-11-11 11:05 ` [pve-devel] [PATCH installer v3 3/3] test: add test for kernel commandline parsing Christoph Heiss
2024-11-11 12:30 ` [pve-devel] applied: [PATCH installer v3 0/3] properly filter out all installer-related kernel arguments Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241111110523.261482-2-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.