[pve-devel] [PATCH installer] proxinstall: fix empty error message when default hostname is not changed

Christoph Heiss c.heiss at proxmox.com
Tue Feb 27 10:33:42 CET 2024


Perl strikes again - while an empty string evaluates falsy in Perl, it
is still defined and thus the //-operator cannot be used here.

Fixes: 93892c0 ("proxinstall: avoid open-coding FQDN sanity check")
Reported-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxinstall | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 351b240..d28aeaa 100755
--- a/proxinstall
+++ b/proxinstall
@@ -461,7 +461,8 @@ sub create_ipconf_view {
 	my $err = $@;
 
 	if ($err || $text =~ m/.example.invalid$/) {
-	    Proxmox::UI::message($err // 'Hostname does not look like a valid fully qualified domain name');
+	    $err = 'Hostname does not look like a valid fully qualified domain name' if !$err;
+	    Proxmox::UI::message($err);
 	    $hostentry->grab_focus();
 	    return;
 	} else {
-- 
2.43.0





More information about the pve-devel mailing list