nextcloud / nextcloud/groupquota

occ groupquota:list with a group which has been deleted results in an exception

Open
#78 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
PHP
Stars
35
Forks
10
Avg merge
4m
Merged PRs (30d)
1

Description

I'm fairly certain that this is because I have a group which I have since set a group quota for and then deleted.


root@cloud:~# ./occ groupquota:list
/usr/share/nginx/nextcloud ~
PHP Warning:  JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled. in Unknown on line 0
group                                         |free                                           |used                                           |total                                          
----------------------------------------------|-----------------------------------------------|-----------------------------------------------|-----------------------------------------------
Bollinger                                     |2198996259191                                  |26996361                                       |2199023255552                                  
Brown                                         |2199023255552                                  |0                                              |2199023255552                                  
Dumbass                                       |1311362628688                                  |887660626864                                   |2199023255552                                  
An unhandled exception has been thrown:
TypeError: OCA\GroupQuota\Quota\UsedSpaceCalculator::getUsedSpaceByGroup(): Argument #1 ($group) must be of type OCP\IGroup, null given, called in /usr/share/nginx/nextcloud/apps/groupquota/lib/Command/QuotaList.php on line 78 and defined in /usr/share/nginx/nextcloud/apps/groupquota/lib/Quota/UsedSpaceCalculator.php:42
Stack trace:
#0 /usr/share/nginx/nextcloud/apps/groupquota/lib/Command/QuotaList.php(78): OCA\GroupQuota\Quota\UsedSpaceCalculator->getUsedSpaceByGroup()
#1 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OCA\GroupQuota\Command\QuotaList->execute()
#2 /usr/share/nginx/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run()
#3 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(1078): OC\Core\Command\Base->run()
#4 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#5 /usr/share/nginx/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#6 /usr/share/nginx/nextcloud/lib/private/Console/Application.php(183): Symfony\Component\Console\Application->run()
#7 /usr/share/nginx/nextcloud/console.php(87): OC\Console\Application->run()
#8 /usr/share/nginx/nextcloud/occ(33): require_once('...')
#9 {main}~

I'm pretty sure, but not postive that the way to reproduce this is:

  1. Make a group
  2. set a quota on that group
  3. delete said group

There might also be some crufty values in the database as well since I was an early adopter of the plugin. However, in either case, there needs to be a fall back if getting a group returns None.. IE, that group no longer exists.

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

Start with apps/groupquota/lib/Command/QuotaList.php at line 78 and apps/groupquota/lib/Quota/UsedSpaceCalculator.php at line 42, then reproduce the issue with occ groupquota:list after deleting a group that has a quota. Done means the command handles the deleted group without throwing the shown TypeError and still reports the remaining quota entries.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.