* [pve-devel] [PATCH installer] run env: use default error message if country detection failed with empty string
@ 2024-03-26 13:29 Christoph Heiss
2024-04-08 16:02 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2024-03-26 13:29 UTC (permalink / raw)
To: pve-devel
Bit of perl fun again.
$err from detect_country_tracing_to() can be empty string under certain
circumstances (according to a forum post [0]). The // operator
evaluates an empty as true, thus `warn` receives an empty string to and
just prints
Warning: something wrong at /usr/share/perl5/proxmox/Install/RunEnv.pm line 305
Which isn't particular helpful. Use the || operator instead, that
evaluates an empty string as false and thus would fall back to the
generic error message.
A minimal reproducer/example for completeness sake:
#!/usr/bin/env perl
use strict;
use warnings;
warn ('' // "unable to detect country\n");
warn ('' || "unable to detect country\n");
gives
Warning: something's wrong at ./test.pl line 5.
unable to detect country
[0] https://forum.proxmox.com/threads/blank-screen-while-installing.143928/
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Proxmox/Install/RunEnv.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm
index 25b6bb3..39505d0 100644
--- a/Proxmox/Install/RunEnv.pm
+++ b/Proxmox/Install/RunEnv.pm
@@ -302,7 +302,7 @@ sub query_installation_environment : prototype() {
if (defined($country)) {
$output->{country} = $country;
} else {
- warn ($err // "unable to detect country\n");
+ warn ($err || "unable to detect country\n");
}
return $output;
--
2.43.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH installer] run env: use default error message if country detection failed with empty string
2024-03-26 13:29 [pve-devel] [PATCH installer] run env: use default error message if country detection failed with empty string Christoph Heiss
@ 2024-04-08 16:02 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-04-08 16:02 UTC (permalink / raw)
To: Proxmox VE development discussion, Christoph Heiss
Am 26/03/2024 um 14:29 schrieb Christoph Heiss:
> Bit of perl fun again.
> $err from detect_country_tracing_to() can be empty string under certain
> circumstances (according to a forum post [0]). The // operator
> evaluates an empty as true, thus `warn` receives an empty string to and
> just prints
>
> Warning: something wrong at /usr/share/perl5/proxmox/Install/RunEnv.pm line 305
>
> Which isn't particular helpful. Use the || operator instead, that
> evaluates an empty string as false and thus would fall back to the
> generic error message.
>
> A minimal reproducer/example for completeness sake:
>
> #!/usr/bin/env perl
> use strict;
> use warnings;
>
> warn ('' // "unable to detect country\n");
> warn ('' || "unable to detect country\n");
>
> gives
>
> Warning: something's wrong at ./test.pl line 5.
> unable to detect country
>
> [0] https://forum.proxmox.com/threads/blank-screen-while-installing.143928/
>
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
> Proxmox/Install/RunEnv.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-08 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 13:29 [pve-devel] [PATCH installer] run env: use default error message if country detection failed with empty string Christoph Heiss
2024-04-08 16:02 ` [pve-devel] applied: " Thomas Lamprecht
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