The architecture fallback branch relied on detect_architecture(...)
failing and therefore $arch being undef afterwards.
However, if protected_call(sub { detect_architecture(...) }) itself
returns a defined, falsy value, such as a empty string converted from an
undef value, the 'arch' field will be set to that value, which will make
the container fail to start.
Therefore, fallback to 'amd64' for any falsy $arch value.
Signed-off-by: Daniel Kral <[email protected]>
---
changes from v1:
- adapt patch message regarding the protected_call(...)
src/PVE/LXC/Setup.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 113093d..fb0207e 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -153,7 +153,7 @@ sub new {
warn "Architecture detection failed: $err" if $err;
}
- if (!defined($arch)) {
+ if (!$arch) {
$arch = 'amd64';
print "Falling back to $arch.\nUse `pct set VMID --arch ARCH` to
change.\n";
} else {
--
2.47.3