all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters
       [not found] <20260121101949.175620-1-a.bied-charreton@proxmox.com>
@ 2026-01-21 10:15 ` Arthur Bied-Charreton
  2026-01-21 10:37   ` Arthur Bied-Charreton
  0 siblings, 1 reply; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-01-21 10:15 UTC (permalink / raw)
  To: a.bied-charreton, pve-devel

The regex in Storage::parse_lvm_name requires at least 2 characters, but
shorter IDs only failed with "contains illegal characters". Add explicit
length check to return a clearer error message in this case.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage/Plugin.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 6f3d691..58f714c 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -333,6 +333,11 @@ PVE::JSONSchema::register_format('pve-storage-vgname', \&parse_lvm_name);
 sub parse_lvm_name {
     my ($name, $noerr) = @_;
 
+    if (length($name) < 2) {
+        return undef if $noerr;
+        die "lvm name '$name' can't be shorter than 2 characters\n";
+    }
+
     if ($name !~ m/^[a-z0-9][a-z0-9\-\_\.]*[a-z0-9]$/i) {
         return undef if $noerr;
         die "lvm name '$name' contains illegal characters\n";
-- 
2.47.3


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters
  2026-01-21 10:15 ` [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters Arthur Bied-Charreton
@ 2026-01-21 10:37   ` Arthur Bied-Charreton
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-01-21 10:37 UTC (permalink / raw)
  To: pve-devel

On Wed, Jan 21, 2026 at 11:15:08AM +0100, Arthur Bied-Charreton wrote:
> The regex in Storage::parse_lvm_name requires at least 2 characters, but
> shorter IDs only failed with "contains illegal characters". Add explicit
> length check to return a clearer error message in this case.
> 
> Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
> ---
>  src/PVE/Storage/Plugin.pm | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 6f3d691..58f714c 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -333,6 +333,11 @@ PVE::JSONSchema::register_format('pve-storage-vgname', \&parse_lvm_name);
>  sub parse_lvm_name {
>      my ($name, $noerr) = @_;
>  
> +    if (length($name) < 2) {
> +        return undef if $noerr;
> +        die "lvm name '$name' can't be shorter than 2 characters\n";
> +    }
> +
>      if ($name !~ m/^[a-z0-9][a-z0-9\-\_\.]*[a-z0-9]$/i) {
>          return undef if $noerr;
>          die "lvm name '$name' contains illegal characters\n";
> -- 
> 2.47.3
> 
> 
This was supposed to be sent as part of a series, sorry about that,
please disregard and refer to:
https://lore.proxmox.com/pve-devel/20260121103407.187187-1-a.bied-charreton@proxmox.com/T/#t


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters
  2026-01-21 10:32 [pve-devel] [PATCH 0/5] fix #7077: Improve ID validation error messages Arthur Bied-Charreton
@ 2026-01-21 10:32 ` Arthur Bied-Charreton
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-01-21 10:32 UTC (permalink / raw)
  To: pve-devel

The regex in Storage::parse_lvm_name requires at least 2 characters, but
shorter IDs only failed with "contains illegal characters". Add explicit
length check to return a clearer error message in this case.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage/Plugin.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 6f3d691..58f714c 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -333,6 +333,11 @@ PVE::JSONSchema::register_format('pve-storage-vgname', \&parse_lvm_name);
 sub parse_lvm_name {
     my ($name, $noerr) = @_;
 
+    if (length($name) < 2) {
+        return undef if $noerr;
+        die "lvm name '$name' can't be shorter than 2 characters\n";
+    }
+
     if ($name !~ m/^[a-z0-9][a-z0-9\-\_\.]*[a-z0-9]$/i) {
         return undef if $noerr;
         die "lvm name '$name' contains illegal characters\n";
-- 
2.47.3


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2026-01-21 10:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20260121101949.175620-1-a.bied-charreton@proxmox.com>
2026-01-21 10:15 ` [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters Arthur Bied-Charreton
2026-01-21 10:37   ` Arthur Bied-Charreton
2026-01-21 10:32 [pve-devel] [PATCH 0/5] fix #7077: Improve ID validation error messages Arthur Bied-Charreton
2026-01-21 10:32 ` [pve-devel] [PATCH pve-storage] fix #7077: Improve error message for IDS shorter than 2 characters Arthur Bied-Charreton

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