all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>,
	Stoiko Ivanov <s.ivanov@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-kernel-meta] proxmox-boot: trim /etc/kernel/cmdline before appending
Date: Wed, 10 Nov 2021 15:48:48 +0100	[thread overview]
Message-ID: <3169edbf-181c-34ec-eec0-2dd54980cdcd@proxmox.com> (raw)
In-Reply-To: <d01179d9-749d-b45a-d0fb-46746a13af65@proxmox.com>

On 10.11.21 15:28, Dominik Csapak wrote:
> comment inline
> 
> On 11/10/21 15:15, Stoiko Ivanov wrote:
>> following the commit of removing the wrong indentation of the linux
>> and initrd lines - this commit strips empty lines (and leading
>> trailing whitespace) in /etc/kernel/cmdline.
>>
>> I managed to reproduce the issue reported in the forum [0] by adding
>> empty lines to /etc/kernel/cmdline) - without this - systemd-boot
>> booted quite happily even with the indentation.
>>
>> quickly tested on a VM.
>>
>> [0]: https://forum.proxmox.com/threads/problem-with-proxmox-boot-tool.99043/
>>
>> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
>> ---
>>   proxmox-boot/zz-proxmox-boot | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
>> index 52171b2..2356c74 100755
>> --- a/proxmox-boot/zz-proxmox-boot
>> +++ b/proxmox-boot/zz-proxmox-boot
>> @@ -50,7 +50,7 @@ update_esps() {
>>           exit 0
>>       fi
>>       if [ -f /etc/kernel/cmdline ]; then
>> -        CMDLINE="$(cat /etc/kernel/cmdline)"
>> +        CMDLINE="$(sed -re '/^\s*$/d;s/^\s+(\S*)\s+$/\1/g' /etc/kernel/cmdline)"
> 
> while the first  part of the regex looks good (delete all lines that only contain whitespace (or nothing), the second part will often not trigger since there is not *only* non-whitespace in the middle?
> 
> should it not be more like:
> 
> '^\s+(.*?)\s+$/\1/g' ?

or just care for trailing whitespaces, i.e. use `head -n 1 /etc/kernel/cmdline` ?

Or alternatively using read should work too:
read -r CMDLINE < /etc/kernel/cmdline 

Important in general is that we only get a single line to not break tools that expect
that during the boot process.




      reply	other threads:[~2021-11-10 14:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 14:15 Stoiko Ivanov
2021-11-10 14:28 ` Dominik Csapak
2021-11-10 14:48   ` Thomas Lamprecht [this message]

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=3169edbf-181c-34ec-eec0-2dd54980cdcd@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.ivanov@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal