public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-kernel-helper] boot tool: fix grep misinterpretation of arguments starting with a hyphen
Date: Fri, 23 Jun 2023 08:13:52 +0200	[thread overview]
Message-ID: <20230623061352.81107-1-h.laimer@proxmox.com> (raw)

`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





             reply	other threads:[~2023-06-23  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23  6:13 Hannes Laimer [this message]
2023-06-29  5:53 ` [pve-devel] applied: " 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=20230623061352.81107-1-h.laimer@proxmox.com \
    --to=h.laimer@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 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