* [pve-devel] [PATCH qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex
@ 2022-02-24 14:49 Stefan Sterz
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Sterz @ 2022-02-24 14:49 UTC (permalink / raw)
To: pve-devel
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
There was a typo in the previous version of this patch, thanks to
@oguz for spotting it.
PVE/QemuServer.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 243c2e5..2347183 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2366,7 +2366,7 @@ sub parse_vm_config {
next;
}
- if ($line =~ m/^\#(.*)\s*$/) {
+ if ($line =~ m/^\#(.*)$/) {
$descr = '' if !defined($descr);
$descr .= PVE::Tools::decode_text($1) . "\n";
next;
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex
2022-02-24 16:28 Dietmar Maurer
@ 2022-02-25 8:26 ` Stefan Sterz
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Sterz @ 2022-02-25 8:26 UTC (permalink / raw)
To: Dietmar Maurer, Proxmox VE development discussion
On 24.02.22 17:28, Dietmar Maurer wrote:
>
>> On 02/24/2022 3:49 PM Stefan Sterz <s.sterz@proxmox.com> wrote:
>>
>>
>> To be consistent with PBS's implementation of multi-line comments
>> remove "\s*" here too. Since the regex isn't lazy .* matches
>> everything \s* would anyway.
>
> But the old regex trimm spaces from the end, so this is quite different!
It would if the ".*" was evaluated lazily (as in ".*?"), but from my
testing it isn't. So since ".*" matches spaces greedily, they are
actually not trimmed. The only character that is matched by "\s" and
not by "." are line breaks, but those occur after the "$".
Hence, "\s" should never match anything here. I've also discussed this
with Wolfgang Bumiller off list.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex
@ 2022-02-24 16:28 Dietmar Maurer
2022-02-25 8:26 ` Stefan Sterz
0 siblings, 1 reply; 3+ messages in thread
From: Dietmar Maurer @ 2022-02-24 16:28 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Sterz
> On 02/24/2022 3:49 PM Stefan Sterz <s.sterz@proxmox.com> wrote:
>
>
> To be consistent with PBS's implementation of multi-line comments
> remove "\s*" here too. Since the regex isn't lazy .* matches
> everything \s* would anyway.
But the old regex trimm spaces from the end, so this is quite different!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-25 8:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 14:49 [pve-devel] [PATCH qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex Stefan Sterz
2022-02-24 16:28 Dietmar Maurer
2022-02-25 8:26 ` Stefan Sterz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox