public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-kernel-helper] boot tool: fix grep misinterpretation of arguments starting with a hyphen
@ 2023-06-23  6:13 Hannes Laimer
  2023-06-29  5:53 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2023-06-23  6:13 UTC (permalink / raw)
  To: pve-devel

`proxmox-boot-tool kernel remove --help`, or any version agrument
that started with a '-', lead to the grep usage message being written
into /etc/kernel/proxmox-boot-manual-kernels. The problem was `grep`
interpreted the kernel version agrument as an option since it starts
with '-'.
---
 src/bin/proxmox-boot-tool | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/proxmox-boot-tool b/src/bin/proxmox-boot-tool
index 913b0f6..302974b 100755
--- a/src/bin/proxmox-boot-tool
+++ b/src/bin/proxmox-boot-tool
@@ -27,7 +27,7 @@ _remove_entry_from_list_file() {
 	fi
 
 	if [ -e "$file" ]; then
-		grep -vFx "$entry" "$file" > "$file.new" || true
+		grep -vFx -- "$entry" "$file" > "$file.new" || true
 		mv "$file.new" "$file"
 	else
 		echo "'$file' does not exist.."
@@ -279,7 +279,7 @@ remove_kernel() {
 		exit 1
 	fi
 
-	if grep -sqFx "$ver" "$MANUAL_KERNEL_LIST"; then
+	if grep -sqFx -- "$ver" "$MANUAL_KERNEL_LIST"; then
 		_remove_entry_from_list_file "$MANUAL_KERNEL_LIST" "$ver"
 		echo "Removed kernel '$ver' from manual kernel list. Use the 'refresh' command to update the ESPs."
 	else
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-29  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23  6:13 [pve-devel] [PATCH proxmox-kernel-helper] boot tool: fix grep misinterpretation of arguments starting with a hyphen Hannes Laimer
2023-06-29  5:53 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal