owncloud / owncloud/core

broken commands kill occ

Open
#33,895 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

comp:console-occ junior job p3-medium sev3-medium Type:Bug
Dominant language
PHP
Stars
8.8k
Forks
2.1k
Avg merge
20h 7m
Merged PRs (30d)
41

Description

If an app ships with an incompatible command the occ command will be broken and unusable, eg:

An unhandled exception has been thrown:
ArgumentCountError: Too few arguments to function OCA\User_LDAP\Command\Search::__construct(), 0 passed in /var/www/owncloud/lib/private/Console/Application.php on line 170 and exactly 3 expected in /var/www/owncloud/apps/user_ldap/lib/Command/Search.php:50
Stack trace:
#0 /var/www/owncloud/lib/private/Console/Application.php(170): OCA\User_LDAP\Command\Search->__construct()
#1 /var/www/owncloud/lib/private/Console/Application.php(108): OC\Console\Application->loadCommandsFromInfoXml(Array)
#2 /var/www/owncloud/console.php(105): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#4 {main}

https://github.com/owncloud/core/blob/3bff5c2aca12499972f285e0cf2ea467a473c6b5/lib/private/Console/Application.php#L164-L178

  • add ILogger to DI,
  • log an error
  • skip to the next command
  • add tests ... currently not covered AFAICT

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read lib/private/Console/Application.php around lines 164-178 and reproduce the incompatible-command failure described in the issue. Add coverage for command loading so one broken command is logged and skipped while later commands remain available, then run the relevant console tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.