Skip to content

fix(InstallDeps): don't chmod an already executable node binary - #1614

Open
SKroman108 wants to merge 1 commit into
nextcloud:mainfrom
SKroman108:fix/testbinary-chmod-warning
Open

SKroman108 wants to merge 1 commit into
nextcloud:mainfrom
SKroman108:fix/testbinary-chmod-warning

Conversation

@SKroman108

Copy link
Copy Markdown

Problem

When node_binary points to a system binary, InstallDeps::testBinary() still calls chmod() on it. The Nextcloud AIO image sets node_binary to /usr/bin/node, which belongs to root, so every repair run (every app or server update) logs:

chmod(): Operation not permitted at /var/www/html/custom_apps/recognize/lib/Migration/InstallDeps.php#176

The binary is already executable and works fine. Only the warning is wrong. This is the same report as #1169, which was closed as a permissions problem on the admin's side. The real cause is that the code always runs chmod().

Reproduce (Nextcloud AIO 35.0.2, recognize 13.2.0, aarch64):

occ config:app:get recognize node_binary   # /usr/bin/node  (-rwxr-xr-x root root)
occ maintenance:repair                     # → chmod(): Operation not permitted

Fix

  • Only call chmod() when the binary isn't executable yet (our own downloaded binary), and suppress the warning if that still fails. exec() reports a binary that really can't run anyway.
  • Initialise $returnCode, so that an exception from exec() doesn't lead to an undefined variable.
  • Use double quotes in the unsupported-architecture warning. Before, it printed the literal $uname.

Tested on the instance above: the old code logs the warning, the new code runs without it and node --version returns v24.22.1.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant