[pve-devel] [PATCH pve-common] remove + from getopt's prefix_pattern

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Sep 2 12:09:54 CEST 2015


Perl by default interprets + as a parameter prefix, which
means commands like `pct resize 103 rootfs +1G` error with
'Unknown option: 1g', we don't want that.
---
 src/PVE/JSONSchema.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index c925ecb..22c0773 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -1077,6 +1077,8 @@ sub get_options {
 	}
     }
 
+    Getopt::Long::Configure('prefix_pattern=(--|-)');
+
     my $opts = {};
     raise("unable to parse option\n", code => HTTP_BAD_REQUEST)
 	if !Getopt::Long::GetOptionsFromArray($args, $opts, @getopt);
-- 
2.1.4





More information about the pve-devel mailing list