Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip inaccessible shares in ownership transfer #49164

Closed

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Nov 8, 2024

Summary

My experience with transfer ownership is limited, so I’m open to feedback on whether this approach makes sense or if there’s a better way to handle this issue.

How to reproduce:

  • Share a file from alice to bob
  • Delete the record in oc_filecache for the file
  • Trigger the transfer ownership from alice to admin
  • See the stack trace below

Why should we not merge this patch:

Deleting the row in oc_filecache was my workaround to trigger the exception, however that's not the case for the customer case. The row and file do exist.

occ files:transfer-ownership bob admin -vvv

Validating quota
Analysing files of bob ...
    0 [->--------------------------] < 1 sec 50.5 MiB
Collecting all share information for files and folders of bob ...
    1 [============================] < 1 sec 50.5 MiB

In View.php line 1777:

  [OCP\Files\NotFoundException]
  File with id "222702" has not been found.

Exception trace:
  at lib/private/Files/View.php:1777
 OC\Files\View->getPath() at apps/files/lib/Service/OwnershipTransferService.php:345
 OCA\Files\Service\OwnershipTransferService->{closure:OCA\Files\Service\OwnershipTransferService::collectUsersShares():343}() at n/a:n/a
 array_map() at apps/files/lib/Service/OwnershipTransferService.php:343
 OCA\Files\Service\OwnershipTransferService->collectUsersShares() at apps/files/lib/Service/OwnershipTransferService.php:137
 OCA\Files\Service\OwnershipTransferService->transfer() at apps/files/lib/Command/TransferOwnership.php:112
 OCA\Files\Command\TransferOwnership->execute() at 3rdparty/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at 3rdparty/symfony/console/Application.php:1078
 Symfony\Component\Console\Application->doRunCommand() at 3rdparty/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at 3rdparty/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at lib/private/Console/Application.php:187
 OC\Console\Application->run() at console.php:87
 require_once() at occ:11

TODO

  • ...

Checklist

When transferring share ownership, the process may fail if the source node is inaccessible. This patch addresses the issue by catching the error, outputting a warning, and allowing the transfer process to continue.

occ files:transfer-ownership bob admin -vvv

Validating quota
Analysing files of bob ...
    0 [->--------------------------] < 1 sec 50.5 MiB
Collecting all share information for files and folders of bob ...
    1 [============================] < 1 sec 50.5 MiB

In View.php line 1777:

  [OCP\Files\NotFoundException]
  File with id "222702" has not been found.

Exception trace:
  at lib/private/Files/View.php:1777
 OC\Files\View->getPath() at apps/files/lib/Service/OwnershipTransferService.php:345
 OCA\Files\Service\OwnershipTransferService->{closure:OCA\Files\Service\OwnershipTransferService::collectUsersShares():343}() at n/a:n/a
 array_map() at apps/files/lib/Service/OwnershipTransferService.php:343
 OCA\Files\Service\OwnershipTransferService->collectUsersShares() at apps/files/lib/Service/OwnershipTransferService.php:137
 OCA\Files\Service\OwnershipTransferService->transfer() at apps/files/lib/Command/TransferOwnership.php:112
 OCA\Files\Command\TransferOwnership->execute() at 3rdparty/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at 3rdparty/symfony/console/Application.php:1078
 Symfony\Component\Console\Application->doRunCommand() at 3rdparty/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at 3rdparty/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at lib/private/Console/Application.php:187
 OC\Console\Application->run() at console.php:87
 require_once() at occ:11

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb self-assigned this Nov 8, 2024
@kesselb kesselb added 2. developing Work in progress bug labels Nov 8, 2024
@kesselb
Copy link
Contributor Author

kesselb commented Jan 16, 2025

Replaced by #49761

@kesselb kesselb closed this Jan 16, 2025
@kesselb kesselb deleted the bug/noid/skip-exceptions-in-transfer-ownership branch January 16, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant