[Bug]: Shared Collectives cause "Path not found" when scannig files with "occ files:scan --all"
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
When a Collective is shared with one or more users and you start a manual file scan using occ files:scan --all, this leads to the following error message for each user who is member of a Collective circle:
Path not found: /username
Where username is the name of the affected user.
Steps to reproduce
- Create a collective
- Share it with at least one other user
- Run
occ files:scan --allin a terminal
Expected behavior
occ files:scan --all runs without "Path not found" error messages
Installation method
Community Manual installation with Archive
Nextcloud Server version
28
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 22 to 23)
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
There is a workaround to fix this. In /server/lib/private/Files/Utils/Scanner.php the following code needs to be added, so Collectives mounts will be ignored during a file scan:
// don't scan received local shares, these can be scanned when scanning the owner's storage
if ($storage->instanceOfStorage(SharedStorage::class)
|| $storage->instanceOfStorage(CollectiveStorage::class)
) {
continue;
}
Also see https://help.nextcloud.com/t/occ-files-scan-outputs-path-not-found-for-some-users/177507/12 and https://github.com/nextcloud/server/blob/5125c34f011651821d3a1d6e3ce2d0337ab75fe9/lib/private/Files/Utils/Scanner.php#L237-L239
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.
Research direction
Start in lib/private/Files/Utils/Scanner.php and reproduce the issue with occ files:scan --all after sharing a Collective. Review the existing handling for SharedStorage and the reported CollectiveStorage workaround. Done means the scan completes without Path not found errors for users in Collective circles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100