files:transfer-ownership fails with "not enough free space" when the target quota is unlimited
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in apps/files/lib/Service/OwnershipTransferService.php, especially OwnershipTransferService::analyse() around the free-space check, and trace the quota values described in the issue. Reproduce with an object store as primary storage and an unlimited destination quota using occ files:transfer-ownership; done means a non-empty transfer no longer aborts because the destination quota is unlimited or not computable.
Written by the indexing model from the issue text.
Description
Bug description
occ files:transfer-ownership aborts with Target user does not have enough free space available. when the destination user has unlimited quota on an instance using object storage as primary storage — it fails precisely because the target has no limit.
Cause
OwnershipTransferService::analyse():
$freeSpace = $view->free_space($destinationUid . '/files/');
if ($size > $freeSpace && $freeSpace !== FileInfo::SPACE_UNKNOWN) {
free_space() returns negative sentinels, but the guard exempts only SPACE_UNKNOWN (-2). For a quota-less user, Quota::free_space() passes through to ObjectStoreStorage::free_space(), which returns SPACE_UNLIMITED (-3) when no totalSizeLimit is set. $size > -3 is true for any non-empty source, so it throws. SPACE_NOT_COMPUTED (-1) has the same flaw.
Not reachable on local primary storage, where an unlimited-quota user gets real disk free space — which is probably why it hasn't surfaced before.
Steps to reproduce
- Object store as primary storage, no
totalSizeLimit. - Destination user quota
none. occ files:transfer-ownership --path="<non-empty folder>" <source> <destination>
Workaround
Set a finite quota on the destination, transfer, set it back to none.
Version
34.0.3, and present on master @ 22bd34a.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d
- Merged PRs (30d)
- 725
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/server
-
3. to review
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
0. Needs triage 33-feedback bug feature: dashboard feature: files feature: theming needs info
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
.htaccess whitelist missing .json/.ftl → files_pdfviewer locale 404s, PDF viewer stuck in English Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
0. Needs triage 34-feedback bug
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
0. Needs triage 34-feedback bug feature: object storage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in nextcloud/server
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·