From a1512ea0d28fcc68bbba76dc24b7b46ff922106d Mon Sep 17 00:00:00 2001 From: SKroman108 <138336203+SKroman108@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:28:34 +0100 Subject: [PATCH] fix(InstallDeps): don't chmod an already executable node binary When node_binary points to a system binary such as /usr/bin/node (the Nextcloud AIO image sets it this way), it belongs to root, so chmod() fails and every repair run logs "chmod(): Operation not permitted at .../InstallDeps.php#176". Only try to make the binary executable when it isn't already, and initialise $returnCode in case exec() throws. Also use double quotes so the unsupported-architecture warning shows the architecture. Signed-off-by: SKroman108 <138336203+SKroman108@users.noreply.github.com> --- lib/Migration/InstallDeps.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Migration/InstallDeps.php b/lib/Migration/InstallDeps.php index 4f074c23..4ac44df6 100644 --- a/lib/Migration/InstallDeps.php +++ b/lib/Migration/InstallDeps.php @@ -148,7 +148,7 @@ protected function installNodeBinary(IOutput $output) : void { $isARM = true; } } else { - $output->warning('CPU architecture $uname is not supported.'); + $output->warning("CPU architecture $uname is not supported."); return; } @@ -171,9 +171,13 @@ protected function testBinary(string $binaryPath): ?string { if (!file_exists($binaryPath)) { return null; } + $returnCode = 1; try { - // Make binary executable - chmod($binaryPath, 0755); + // Make our own downloaded binary executable; a binary set by the admin (e.g. /usr/bin/node) + // usually belongs to root and is already executable, so chmod() on it would only fail with a warning + if (!is_executable($binaryPath)) { + @chmod($binaryPath, 0755); + } $cmd = escapeshellcmd($binaryPath) . ' ' . escapeshellarg('--version');